1 // Generated by the protocol buffer compiler. DO NOT EDIT!
2 // source: google/protobuf/timestamp.proto
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
10 #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
11 #import <Protobuf/GPBDescriptor.h>
12 #import <Protobuf/GPBMessage.h>
13 #import <Protobuf/GPBRootObject.h>
15 #import "GPBDescriptor.h"
16 #import "GPBMessage.h"
17 #import "GPBRootObject.h"
20 #if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
21 #error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
23 #if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
24 #error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
27 // @@protoc_insertion_point(imports)
29 #pragma clang diagnostic push
30 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
34 NS_ASSUME_NONNULL_BEGIN
36 #pragma mark - GPBTimestampRoot
39 * Exposes the extension registry for this file.
41 * The base class provides:
43 * + (GPBExtensionRegistry *)extensionRegistry;
45 * which is a @c GPBExtensionRegistry that includes all the extensions defined by
46 * this file and all files that it depends on.
48 @interface GPBTimestampRoot : GPBRootObject
51 #pragma mark - GPBTimestamp
53 typedef GPB_ENUM(GPBTimestamp_FieldNumber) {
54 GPBTimestamp_FieldNumber_Seconds = 1,
55 GPBTimestamp_FieldNumber_Nanos = 2,
59 * A Timestamp represents a point in time independent of any time zone
60 * or calendar, represented as seconds and fractions of seconds at
61 * nanosecond resolution in UTC Epoch time. It is encoded using the
62 * Proleptic Gregorian Calendar which extends the Gregorian calendar
63 * backwards to year one. It is encoded assuming all minutes are 60
64 * seconds long, i.e. leap seconds are "smeared" so that no leap second
65 * table is needed for interpretation. Range is from
66 * 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
67 * By restricting to that range, we ensure that we can convert to
68 * and from RFC 3339 date strings.
69 * See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
73 * Example 1: Compute Timestamp from POSIX `time()`.
75 * Timestamp timestamp;
76 * timestamp.set_seconds(time(NULL));
77 * timestamp.set_nanos(0);
79 * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
82 * gettimeofday(&tv, NULL);
84 * Timestamp timestamp;
85 * timestamp.set_seconds(tv.tv_sec);
86 * timestamp.set_nanos(tv.tv_usec * 1000);
88 * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
91 * GetSystemTimeAsFileTime(&ft);
92 * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
94 * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
95 * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
96 * Timestamp timestamp;
97 * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
98 * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
100 * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
102 * long millis = System.currentTimeMillis();
104 * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
105 * .setNanos((int) ((millis % 1000) * 1000000)).build();
108 * Example 5: Compute Timestamp from current time in Python.
110 * timestamp = Timestamp()
111 * timestamp.GetCurrentTime()
115 * In JSON format, the Timestamp type is encoded as a string in the
116 * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
117 * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
118 * where {year} is always expressed using four digits while {month}, {day},
119 * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
120 * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
121 * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
122 * is required. A proto3 JSON serializer should always use UTC (as indicated by
123 * "Z") when printing the Timestamp type and a proto3 JSON parser should be
124 * able to accept both UTC and other timezones (as indicated by an offset).
126 * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
127 * 01:30 UTC on January 15, 2017.
129 * In JavaScript, one can convert a Date object to this format using the
130 * standard [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 [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
133 * with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
134 * can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
135 * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
136 * ) to obtain a formatter capable of generating timestamps in this format.
138 @interface GPBTimestamp : GPBMessage
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.
145 @property(nonatomic, readwrite) int64_t seconds;
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
153 @property(nonatomic, readwrite) int32_t nanos;
157 NS_ASSUME_NONNULL_END
161 #pragma clang diagnostic pop
163 // @@protoc_insertion_point(global_scope)