blob: 91c124eb880a030e683e9a575d4cb5612ba72707 [file] [log] [blame]
Thomas Van Lenten56c48ae2020-01-22 15:50:52 -05001// Generated by the protocol buffer compiler. DO NOT EDIT!
Protobuf Team Bot37b2e3c2024-04-15 14:34:06 -07002// NO CHECKED-IN PROTOBUF GENCODE
Thomas Van Lenten7c646282022-09-19 13:19:31 -04003// clang-format off
Thomas Van Lenten672adeb2022-10-06 16:16:07 -04004// source: google/protobuf/duration.proto
Thomas Van Lenten7c646282022-09-19 13:19:31 -04005
Thomas Van Lenten020e4e32022-03-01 14:16:50 -05006#import "GPBDescriptor.h"
7#import "GPBMessage.h"
8#import "GPBRootObject.h"
Thomas Van Lenten56c48ae2020-01-22 15:50:52 -05009
Protobuf Team Bot4ed02cc2023-02-08 06:31:58 -080010#if GOOGLE_PROTOBUF_OBJC_VERSION < 30007
Thomas Van Lenten56c48ae2020-01-22 15:50:52 -050011#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
12#endif
Protobuf Team Bot4ed02cc2023-02-08 06:31:58 -080013#if 30007 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
Thomas Van Lenten56c48ae2020-01-22 15:50:52 -050014#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
22CF_EXTERN_C_BEGIN
23
24NS_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 **/
38GPB_FINAL @interface GPBDurationRoot : GPBRootObject
39@end
40
41#pragma mark - GPBDuration
42
43typedef 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 **/
108GPB_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
Thomas Van Lentenb146d142023-12-08 10:42:19 -0800127// NOTE: There are some Objective-C specific methods/properties in
128// GPBWellKnownTypes.h that will likey be useful.
129
Thomas Van Lenten56c48ae2020-01-22 15:50:52 -0500130@end
131
132NS_ASSUME_NONNULL_END
133
134CF_EXTERN_C_END
135
136#pragma clang diagnostic pop
137
138// @@protoc_insertion_point(global_scope)
Thomas Van Lenten7c646282022-09-19 13:19:31 -0400139
Protobuf Team Bot4df096f2022-12-01 09:00:00 -0800140// clang-format on