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