blob: 510ecc03160451fe6a7d2912c933a695e42b5671 [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/timestamp.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 - GPBTimestampRoot
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 GPBTimestampRoot : GPBRootObject
38@end
39
40#pragma mark - GPBTimestamp
41
42typedef GPB_ENUM(GPBTimestamp_FieldNumber) {
43 GPBTimestamp_FieldNumber_Seconds = 1,
44 GPBTimestamp_FieldNumber_Nanos = 2,
45};
46
47/**
48 * A Timestamp represents a point in time independent of any time zone or local
49 * calendar, encoded as a count of seconds and fractions of seconds at
50 * nanosecond resolution. The count is relative to an epoch at UTC midnight on
51 * January 1, 1970, in the proleptic Gregorian calendar which extends the
52 * Gregorian calendar backwards to year one.
53 *
54 * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
55 * second table is needed for interpretation, using a [24-hour linear
56 * smear](https://developers.google.com/time/smear).
57 *
58 * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
59 * restricting to that range, we ensure that we can convert to and from [RFC
60 * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
61 *
62 * # Examples
63 *
64 * Example 1: Compute Timestamp from POSIX `time()`.
65 *
66 * Timestamp timestamp;
67 * timestamp.set_seconds(time(NULL));
68 * timestamp.set_nanos(0);
69 *
70 * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
71 *
72 * struct timeval tv;
73 * gettimeofday(&tv, NULL);
74 *
75 * Timestamp timestamp;
76 * timestamp.set_seconds(tv.tv_sec);
77 * timestamp.set_nanos(tv.tv_usec * 1000);
78 *
79 * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
80 *
81 * FILETIME ft;
82 * GetSystemTimeAsFileTime(&ft);
83 * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
84 *
85 * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
86 * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
87 * Timestamp timestamp;
88 * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
89 * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
90 *
91 * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
92 *
93 * long millis = System.currentTimeMillis();
94 *
95 * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
96 * .setNanos((int) ((millis % 1000) * 1000000)).build();
97 *
Joshua Haberman95e6c5b2020-08-17 15:26:13 -070098 * Example 5: Compute Timestamp from Java `Instant.now()`.
99 *
100 * Instant now = Instant.now();
101 *
102 * Timestamp timestamp =
103 * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
104 * .setNanos(now.getNano()).build();
105 *
Joshua Haberman95e6c5b2020-08-17 15:26:13 -0700106 * Example 6: Compute Timestamp from current time in Python.
Thomas Van Lenten56c48ae2020-01-22 15:50:52 -0500107 *
108 * timestamp = Timestamp()
109 * timestamp.GetCurrentTime()
110 *
111 * # JSON Mapping
112 *
113 * In JSON format, the Timestamp type is encoded as a string in the
114 * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
115 * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
116 * where {year} is always expressed using four digits while {month}, {day},
117 * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
118 * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
119 * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
120 * is required. A proto3 JSON serializer should always use UTC (as indicated by
121 * "Z") when printing the Timestamp type and a proto3 JSON parser should be
122 * able to accept both UTC and other timezones (as indicated by an offset).
123 *
124 * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
125 * 01:30 UTC on January 15, 2017.
126 *
127 * In JavaScript, one can convert a Date object to this format using the
128 * standard
129 * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
130 * method. In Python, a standard `datetime.datetime` object can be converted
131 * to this format using
132 * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
133 * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
134 * the Joda Time's [`ISODateTimeFormat.dateTime()`](
Adam Cozzetteb81c1272023-03-16 13:28:05 -0700135 * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
Thomas Van Lenten56c48ae2020-01-22 15:50:52 -0500136 * ) to obtain a formatter capable of generating timestamps in this format.
137 **/
138GPB_FINAL @interface GPBTimestamp : GPBMessage
139
140/**
141 * Represents seconds of UTC time since Unix epoch
142 * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
143 * 9999-12-31T23:59:59Z inclusive.
144 **/
145@property(nonatomic, readwrite) int64_t seconds;
146
147/**
148 * Non-negative fractions of a second at nanosecond resolution. Negative
149 * second values with fractions must still have non-negative nanos values
150 * that count forward in time. Must be from 0 to 999,999,999
151 * inclusive.
152 **/
153@property(nonatomic, readwrite) int32_t nanos;
154
155@end
156
157NS_ASSUME_NONNULL_END
158
159CF_EXTERN_C_END
160
161#pragma clang diagnostic pop
162
163// @@protoc_insertion_point(global_scope)
Thomas Van Lenten7c646282022-09-19 13:19:31 -0400164
Protobuf Team Bot4df096f2022-12-01 09:00:00 -0800165// clang-format on