• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: google/protobuf/duration.proto
3 
4 #import "GPBDescriptor.h"
5 #import "GPBMessage.h"
6 #import "GPBRootObject.h"
7 
8 #if GOOGLE_PROTOBUF_OBJC_VERSION < 30004
9 #error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
10 #endif
11 #if 30004 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
12 #error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
13 #endif
14 
15 // @@protoc_insertion_point(imports)
16 
17 #pragma clang diagnostic push
18 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
19 
20 CF_EXTERN_C_BEGIN
21 
22 NS_ASSUME_NONNULL_BEGIN
23 
24 #pragma mark - GPBDurationRoot
25 
26 /**
27  * Exposes the extension registry for this file.
28  *
29  * The base class provides:
30  * @code
31  *   + (GPBExtensionRegistry *)extensionRegistry;
32  * @endcode
33  * which is a @c GPBExtensionRegistry that includes all the extensions defined by
34  * this file and all files that it depends on.
35  **/
36 GPB_FINAL @interface GPBDurationRoot : GPBRootObject
37 @end
38 
39 #pragma mark - GPBDuration
40 
41 typedef GPB_ENUM(GPBDuration_FieldNumber) {
42   GPBDuration_FieldNumber_Seconds = 1,
43   GPBDuration_FieldNumber_Nanos = 2,
44 };
45 
46 /**
47  * A Duration represents a signed, fixed-length span of time represented
48  * as a count of seconds and fractions of seconds at nanosecond
49  * resolution. It is independent of any calendar and concepts like "day"
50  * or "month". It is related to Timestamp in that the difference between
51  * two Timestamp values is a Duration and it can be added or subtracted
52  * from a Timestamp. Range is approximately +-10,000 years.
53  *
54  * # Examples
55  *
56  * Example 1: Compute Duration from two Timestamps in pseudo code.
57  *
58  *     Timestamp start = ...;
59  *     Timestamp end = ...;
60  *     Duration duration = ...;
61  *
62  *     duration.seconds = end.seconds - start.seconds;
63  *     duration.nanos = end.nanos - start.nanos;
64  *
65  *     if (duration.seconds < 0 && duration.nanos > 0) {
66  *       duration.seconds += 1;
67  *       duration.nanos -= 1000000000;
68  *     } else if (duration.seconds > 0 && duration.nanos < 0) {
69  *       duration.seconds -= 1;
70  *       duration.nanos += 1000000000;
71  *     }
72  *
73  * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
74  *
75  *     Timestamp start = ...;
76  *     Duration duration = ...;
77  *     Timestamp end = ...;
78  *
79  *     end.seconds = start.seconds + duration.seconds;
80  *     end.nanos = start.nanos + duration.nanos;
81  *
82  *     if (end.nanos < 0) {
83  *       end.seconds -= 1;
84  *       end.nanos += 1000000000;
85  *     } else if (end.nanos >= 1000000000) {
86  *       end.seconds += 1;
87  *       end.nanos -= 1000000000;
88  *     }
89  *
90  * Example 3: Compute Duration from datetime.timedelta in Python.
91  *
92  *     td = datetime.timedelta(days=3, minutes=10)
93  *     duration = Duration()
94  *     duration.FromTimedelta(td)
95  *
96  * # JSON Mapping
97  *
98  * In JSON format, the Duration type is encoded as a string rather than an
99  * object, where the string ends in the suffix "s" (indicating seconds) and
100  * is preceded by the number of seconds, with nanoseconds expressed as
101  * fractional seconds. For example, 3 seconds with 0 nanoseconds should be
102  * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
103  * be expressed in JSON format as "3.000000001s", and 3 seconds and 1
104  * microsecond should be expressed in JSON format as "3.000001s".
105  **/
106 GPB_FINAL @interface GPBDuration : GPBMessage
107 
108 /**
109  * Signed seconds of the span of time. Must be from -315,576,000,000
110  * to +315,576,000,000 inclusive. Note: these bounds are computed from:
111  * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
112  **/
113 @property(nonatomic, readwrite) int64_t seconds;
114 
115 /**
116  * Signed fractions of a second at nanosecond resolution of the span
117  * of time. Durations less than one second are represented with a 0
118  * `seconds` field and a positive or negative `nanos` field. For durations
119  * of one second or more, a non-zero value for the `nanos` field must be
120  * of the same sign as the `seconds` field. Must be from -999,999,999
121  * to +999,999,999 inclusive.
122  **/
123 @property(nonatomic, readwrite) int32_t nanos;
124 
125 @end
126 
127 NS_ASSUME_NONNULL_END
128 
129 CF_EXTERN_C_END
130 
131 #pragma clang diagnostic pop
132 
133 // @@protoc_insertion_point(global_scope)
134