aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
diff options
context:
space:
mode:
authorGravatar Jon Skeet <jonskeet@google.com>2015-11-06 18:38:31 +0000
committerGravatar Jon Skeet <jonskeet@google.com>2015-11-06 18:38:31 +0000
commitcff900e8f9e4b8f3a8f314f0f44eab222ebb870b (patch)
tree9bb37e2e6639faa7c020caaccc918e7f81ac844c /csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
parentf4f601bd477e01c98d95dece5a694107205a8134 (diff)
Generated code for previous commit.
Diffstat (limited to 'csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs')
-rw-r--r--csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
index 39251e2e..cc2dfd26 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
@@ -48,12 +48,16 @@ namespace Google.Protobuf.WellKnownTypes {
/// or "month". It is related to Timestamp in that the difference between
/// two Timestamp values is a Duration and it can be added or subtracted
/// from a Timestamp. Range is approximately +-10,000 years.
+ ///
/// Example 1: Compute Duration from two Timestamps in pseudo code.
+ ///
/// Timestamp start = ...;
/// Timestamp end = ...;
/// Duration duration = ...;
+ ///
/// duration.seconds = end.seconds - start.seconds;
/// duration.nanos = end.nanos - start.nanos;
+ ///
/// if (duration.seconds &lt; 0 &amp;&amp; duration.nanos > 0) {
/// duration.seconds += 1;
/// duration.nanos -= 1000000000;
@@ -61,12 +65,16 @@ namespace Google.Protobuf.WellKnownTypes {
/// duration.seconds -= 1;
/// duration.nanos += 1000000000;
/// }
+ ///
/// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
+ ///
/// Timestamp start = ...;
/// Duration duration = ...;
/// Timestamp end = ...;
+ ///
/// end.seconds = start.seconds + duration.seconds;
/// end.nanos = start.nanos + duration.nanos;
+ ///
/// if (end.nanos &lt; 0) {
/// end.seconds -= 1;
/// end.nanos += 1000000000;