blob: a328afc7c93d4259e3815cdf6ff7fee4cd903380 [file] [log] [blame]
Thomas Van Lenten56c48ae2020-01-22 15:50:52 -05001// Generated by the protocol buffer compiler. DO NOT EDIT!
2// source: google/protobuf/timestamp.proto
3
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
8#endif
9
10#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
11 #import <Protobuf/GPBDescriptor.h>
12 #import <Protobuf/GPBMessage.h>
13 #import <Protobuf/GPBRootObject.h>
14#else
15 #import "GPBDescriptor.h"
16 #import "GPBMessage.h"
17 #import "GPBRootObject.h"
18#endif
19
Joshua Haberman32e5deb2020-04-28 08:40:38 -070020#if GOOGLE_PROTOBUF_OBJC_VERSION < 30004
Thomas Van Lenten56c48ae2020-01-22 15:50:52 -050021#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
22#endif
Joshua Haberman32e5deb2020-04-28 08:40:38 -070023#if 30004 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
Thomas Van Lenten56c48ae2020-01-22 15:50:52 -050024#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
25#endif
26
27// @@protoc_insertion_point(imports)
28
29#pragma clang diagnostic push
30#pragma clang diagnostic ignored "-Wdeprecated-declarations"
31
32CF_EXTERN_C_BEGIN
33
34NS_ASSUME_NONNULL_BEGIN
35
36#pragma mark - GPBTimestampRoot
37
38/**
39 * Exposes the extension registry for this file.
40 *
41 * The base class provides:
42 * @code
43 * + (GPBExtensionRegistry *)extensionRegistry;
44 * @endcode
45 * which is a @c GPBExtensionRegistry that includes all the extensions defined by
46 * this file and all files that it depends on.
47 **/
48GPB_FINAL @interface GPBTimestampRoot : GPBRootObject
49@end
50
51#pragma mark - GPBTimestamp
52
53typedef GPB_ENUM(GPBTimestamp_FieldNumber) {
54 GPBTimestamp_FieldNumber_Seconds = 1,
55 GPBTimestamp_FieldNumber_Nanos = 2,
56};
57
58/**
59 * A Timestamp represents a point in time independent of any time zone or local
60 * calendar, encoded as a count of seconds and fractions of seconds at
61 * nanosecond resolution. The count is relative to an epoch at UTC midnight on
62 * January 1, 1970, in the proleptic Gregorian calendar which extends the
63 * Gregorian calendar backwards to year one.
64 *
65 * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
66 * second table is needed for interpretation, using a [24-hour linear
67 * smear](https://developers.google.com/time/smear).
68 *
69 * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
70 * restricting to that range, we ensure that we can convert to and from [RFC
71 * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
72 *
73 * # Examples
74 *
75 * Example 1: Compute Timestamp from POSIX `time()`.
76 *
77 * Timestamp timestamp;
78 * timestamp.set_seconds(time(NULL));
79 * timestamp.set_nanos(0);
80 *
81 * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
82 *
83 * struct timeval tv;
84 * gettimeofday(&tv, NULL);
85 *
86 * Timestamp timestamp;
87 * timestamp.set_seconds(tv.tv_sec);
88 * timestamp.set_nanos(tv.tv_usec * 1000);
89 *
90 * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
91 *
92 * FILETIME ft;
93 * GetSystemTimeAsFileTime(&ft);
94 * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
95 *
96 * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
97 * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
98 * Timestamp timestamp;
99 * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
100 * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
101 *
102 * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
103 *
104 * long millis = System.currentTimeMillis();
105 *
106 * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
107 * .setNanos((int) ((millis % 1000) * 1000000)).build();
108 *
109 *
Joshua Haberman95e6c5b2020-08-17 15:26:13 -0700110 * Example 5: Compute Timestamp from Java `Instant.now()`.
111 *
112 * Instant now = Instant.now();
113 *
114 * Timestamp timestamp =
115 * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
116 * .setNanos(now.getNano()).build();
117 *
118 *
119 * Example 6: Compute Timestamp from current time in Python.
Thomas Van Lenten56c48ae2020-01-22 15:50:52 -0500120 *
121 * timestamp = Timestamp()
122 * timestamp.GetCurrentTime()
123 *
124 * # JSON Mapping
125 *
126 * In JSON format, the Timestamp type is encoded as a string in the
127 * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
128 * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
129 * where {year} is always expressed using four digits while {month}, {day},
130 * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
131 * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
132 * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
133 * is required. A proto3 JSON serializer should always use UTC (as indicated by
134 * "Z") when printing the Timestamp type and a proto3 JSON parser should be
135 * able to accept both UTC and other timezones (as indicated by an offset).
136 *
137 * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
138 * 01:30 UTC on January 15, 2017.
139 *
140 * In JavaScript, one can convert a Date object to this format using the
141 * standard
142 * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
143 * method. In Python, a standard `datetime.datetime` object can be converted
144 * to this format using
145 * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
146 * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
147 * the Joda Time's [`ISODateTimeFormat.dateTime()`](
148 * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
149 * ) to obtain a formatter capable of generating timestamps in this format.
150 **/
151GPB_FINAL @interface GPBTimestamp : GPBMessage
152
153/**
154 * Represents seconds of UTC time since Unix epoch
155 * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
156 * 9999-12-31T23:59:59Z inclusive.
157 **/
158@property(nonatomic, readwrite) int64_t seconds;
159
160/**
161 * Non-negative fractions of a second at nanosecond resolution. Negative
162 * second values with fractions must still have non-negative nanos values
163 * that count forward in time. Must be from 0 to 999,999,999
164 * inclusive.
165 **/
166@property(nonatomic, readwrite) int32_t nanos;
167
168@end
169
170NS_ASSUME_NONNULL_END
171
172CF_EXTERN_C_END
173
174#pragma clang diagnostic pop
175
176// @@protoc_insertion_point(global_scope)