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