OLD | NEW |
1 #region Copyright notice and license | 1 #region Copyright notice and license |
2 // Protocol Buffers - Google's data interchange format | 2 // Protocol Buffers - Google's data interchange format |
3 // Copyright 2015 Google Inc. All rights reserved. | 3 // Copyright 2015 Google Inc. All rights reserved. |
4 // https://developers.google.com/protocol-buffers/ | 4 // https://developers.google.com/protocol-buffers/ |
5 // | 5 // |
6 // Redistribution and use in source and binary forms, with or without | 6 // Redistribution and use in source and binary forms, with or without |
7 // modification, are permitted provided that the following conditions are | 7 // modification, are permitted provided that the following conditions are |
8 // met: | 8 // met: |
9 // | 9 // |
10 // * Redistributions of source code must retain the above copyright | 10 // * Redistributions of source code must retain the above copyright |
(...skipping 13 matching lines...) Expand all Loading... |
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
31 #endregion | 31 #endregion |
32 | 32 |
33 using System; | 33 using System; |
34 using System.Collections.Generic; | |
35 using System.Linq; | |
36 using System.Text; | |
37 using System.Threading.Tasks; | |
38 | 34 |
39 namespace Google.Protobuf.WellKnownTypes | 35 namespace Google.Protobuf.WellKnownTypes |
40 { | 36 { |
41 /// <summary> | 37 /// <summary> |
42 /// Extension methods on BCL time-related types, converting to protobuf type
s. | 38 /// Extension methods on BCL time-related types, converting to protobuf type
s. |
43 /// </summary> | 39 /// </summary> |
44 public static class TimeExtensions | 40 public static class TimeExtensions |
45 { | 41 { |
46 /// <summary> | 42 /// <summary> |
47 /// Converts the given <see cref="DateTime"/> to a <see cref="Timestamp"
/>. | 43 /// Converts the given <see cref="DateTime"/> to a <see cref="Timestamp"
/>. |
(...skipping 23 matching lines...) Expand all Loading... |
71 /// Converts the given <see cref="TimeSpan"/> to a <see cref="Duration"/
>. | 67 /// Converts the given <see cref="TimeSpan"/> to a <see cref="Duration"/
>. |
72 /// </summary> | 68 /// </summary> |
73 /// <param name="timeSpan">The time span to convert.</param> | 69 /// <param name="timeSpan">The time span to convert.</param> |
74 /// <returns>The converted duration.</returns> | 70 /// <returns>The converted duration.</returns> |
75 public static Duration ToDuration(this TimeSpan timeSpan) | 71 public static Duration ToDuration(this TimeSpan timeSpan) |
76 { | 72 { |
77 return Duration.FromTimeSpan(timeSpan); | 73 return Duration.FromTimeSpan(timeSpan); |
78 } | 74 } |
79 } | 75 } |
80 } | 76 } |
OLD | NEW |