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