1 // Generated by the protocol buffer compiler. DO NOT EDIT!
2 // source: google/protobuf/duration.proto
4 // This CPP symbol can be defined to use imports that match up to the framework
5 // imports needed when using CocoaPods.
6 #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
7 #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
10 #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
11 #import <Protobuf/GPBDescriptor.h>
12 #import <Protobuf/GPBMessage.h>
13 #import <Protobuf/GPBRootObject.h>
15 #import "GPBDescriptor.h"
16 #import "GPBMessage.h"
17 #import "GPBRootObject.h"
20 #if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
21 #error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
23 #if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
24 #error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
27 // @@protoc_insertion_point(imports)
29 #pragma clang diagnostic push
30 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
34 NS_ASSUME_NONNULL_BEGIN
36 #pragma mark - GPBDurationRoot
39 * Exposes the extension registry for this file.
41 * The base class provides:
43 * + (GPBExtensionRegistry *)extensionRegistry;
45 * which is a @c GPBExtensionRegistry that includes all the extensions defined by
46 * this file and all files that it depends on.
48 @interface GPBDurationRoot : GPBRootObject
51 #pragma mark - GPBDuration
53 typedef GPB_ENUM(GPBDuration_FieldNumber) {
54 GPBDuration_FieldNumber_Seconds = 1,
55 GPBDuration_FieldNumber_Nanos = 2,
59 * A Duration represents a signed, fixed-length span of time represented
60 * as a count of seconds and fractions of seconds at nanosecond
61 * resolution. It is independent of any calendar and concepts like "day"
62 * or "month". It is related to Timestamp in that the difference between
63 * two Timestamp values is a Duration and it can be added or subtracted
64 * from a Timestamp. Range is approximately +-10,000 years.
68 * Example 1: Compute Duration from two Timestamps in pseudo code.
70 * Timestamp start = ...;
71 * Timestamp end = ...;
72 * Duration duration = ...;
74 * duration.seconds = end.seconds - start.seconds;
75 * duration.nanos = end.nanos - start.nanos;
77 * if (duration.seconds < 0 && duration.nanos > 0) {
78 * duration.seconds += 1;
79 * duration.nanos -= 1000000000;
80 * } else if (durations.seconds > 0 && duration.nanos < 0) {
81 * duration.seconds -= 1;
82 * duration.nanos += 1000000000;
85 * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
87 * Timestamp start = ...;
88 * Duration duration = ...;
89 * Timestamp end = ...;
91 * end.seconds = start.seconds + duration.seconds;
92 * end.nanos = start.nanos + duration.nanos;
94 * if (end.nanos < 0) {
96 * end.nanos += 1000000000;
97 * } else if (end.nanos >= 1000000000) {
99 * end.nanos -= 1000000000;
102 * Example 3: Compute Duration from datetime.timedelta in Python.
104 * td = datetime.timedelta(days=3, minutes=10)
105 * duration = Duration()
106 * duration.FromTimedelta(td)
110 * In JSON format, the Duration type is encoded as a string rather than an
111 * object, where the string ends in the suffix "s" (indicating seconds) and
112 * is preceded by the number of seconds, with nanoseconds expressed as
113 * fractional seconds. For example, 3 seconds with 0 nanoseconds should be
114 * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
115 * be expressed in JSON format as "3.000000001s", and 3 seconds and 1
116 * microsecond should be expressed in JSON format as "3.000001s".
118 @interface GPBDuration : GPBMessage
121 * Signed seconds of the span of time. Must be from -315,576,000,000
122 * to +315,576,000,000 inclusive. Note: these bounds are computed from:
123 * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
125 @property(nonatomic, readwrite) int64_t seconds;
128 * Signed fractions of a second at nanosecond resolution of the span
129 * of time. Durations less than one second are represented with a 0
130 * `seconds` field and a positive or negative `nanos` field. For durations
131 * of one second or more, a non-zero value for the `nanos` field must be
132 * of the same sign as the `seconds` field. Must be from -999,999,999
133 * to +999,999,999 inclusive.
135 @property(nonatomic, readwrite) int32_t nanos;
139 NS_ASSUME_NONNULL_END
143 #pragma clang diagnostic pop
145 // @@protoc_insertion_point(global_scope)