aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/golang/protobuf/ptypes/duration/duration.proto
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/golang/protobuf/ptypes/duration/duration.proto')
-rw-r--r--vendor/github.com/golang/protobuf/ptypes/duration/duration.proto23
1 files changed, 21 insertions, 2 deletions
diff --git a/vendor/github.com/golang/protobuf/ptypes/duration/duration.proto b/vendor/github.com/golang/protobuf/ptypes/duration/duration.proto
index 96c1796..975fce4 100644
--- a/vendor/github.com/golang/protobuf/ptypes/duration/duration.proto
+++ b/vendor/github.com/golang/protobuf/ptypes/duration/duration.proto
@@ -33,11 +33,11 @@ syntax = "proto3";
package google.protobuf;
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
+option cc_enable_arenas = true;
option go_package = "github.com/golang/protobuf/ptypes/duration";
option java_package = "com.google.protobuf";
option java_outer_classname = "DurationProto";
option java_multiple_files = true;
-option java_generate_equals_and_hash = true;
option objc_class_prefix = "GPB";
// A Duration represents a signed, fixed-length span of time represented
@@ -47,6 +47,8 @@ option objc_class_prefix = "GPB";
// two Timestamp values is a Duration and it can be added or subtracted
// from a Timestamp. Range is approximately +-10,000 years.
//
+// # Examples
+//
// Example 1: Compute Duration from two Timestamps in pseudo code.
//
// Timestamp start = ...;
@@ -81,11 +83,28 @@ option objc_class_prefix = "GPB";
// end.nanos -= 1000000000;
// }
//
+// Example 3: Compute Duration from datetime.timedelta in Python.
+//
+// td = datetime.timedelta(days=3, minutes=10)
+// duration = Duration()
+// duration.FromTimedelta(td)
+//
+// # JSON Mapping
+//
+// In JSON format, the Duration type is encoded as a string rather than an
+// object, where the string ends in the suffix "s" (indicating seconds) and
+// is preceded by the number of seconds, with nanoseconds expressed as
+// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
+// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
+// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
+// microsecond should be expressed in JSON format as "3.000001s".
+//
//
message Duration {
// Signed seconds of the span of time. Must be from -315,576,000,000
- // to +315,576,000,000 inclusive.
+ // to +315,576,000,000 inclusive. Note: these bounds are computed from:
+ // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
int64 seconds = 1;
// Signed fractions of a second at nanosecond resolution of the span