Brian Silverman | 9c614bc | 2016-02-15 20:20:02 -0500 | [diff] [blame^] | 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! |
| 2 | // source: google/protobuf/timestamp.proto |
| 3 | |
| 4 | #import "GPBProtocolBuffers.h" |
| 5 | |
| 6 | #if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000 |
| 7 | #error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources. |
| 8 | #endif |
| 9 | |
| 10 | // @@protoc_insertion_point(imports) |
| 11 | |
| 12 | CF_EXTERN_C_BEGIN |
| 13 | |
| 14 | NS_ASSUME_NONNULL_BEGIN |
| 15 | |
| 16 | #pragma mark - GPBTimestampRoot |
| 17 | |
| 18 | @interface GPBTimestampRoot : GPBRootObject |
| 19 | |
| 20 | // The base class provides: |
| 21 | // + (GPBExtensionRegistry *)extensionRegistry; |
| 22 | // which is an GPBExtensionRegistry that includes all the extensions defined by |
| 23 | // this file and all files that it depends on. |
| 24 | |
| 25 | @end |
| 26 | |
| 27 | #pragma mark - GPBTimestamp |
| 28 | |
| 29 | typedef GPB_ENUM(GPBTimestamp_FieldNumber) { |
| 30 | GPBTimestamp_FieldNumber_Seconds = 1, |
| 31 | GPBTimestamp_FieldNumber_Nanos = 2, |
| 32 | }; |
| 33 | |
| 34 | // A Timestamp represents a point in time independent of any time zone |
| 35 | // or calendar, represented as seconds and fractions of seconds at |
| 36 | // nanosecond resolution in UTC Epoch time. It is encoded using the |
| 37 | // Proleptic Gregorian Calendar which extends the Gregorian calendar |
| 38 | // backwards to year one. It is encoded assuming all minutes are 60 |
| 39 | // seconds long, i.e. leap seconds are "smeared" so that no leap second |
| 40 | // table is needed for interpretation. Range is from |
| 41 | // 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. |
| 42 | // By restricting to that range, we ensure that we can convert to |
| 43 | // and from RFC 3339 date strings. |
| 44 | // See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). |
| 45 | // |
| 46 | // Example 1: Compute Timestamp from POSIX `time()`. |
| 47 | // |
| 48 | // Timestamp timestamp; |
| 49 | // timestamp.set_seconds(time(NULL)); |
| 50 | // timestamp.set_nanos(0); |
| 51 | // |
| 52 | // Example 2: Compute Timestamp from POSIX `gettimeofday()`. |
| 53 | // |
| 54 | // struct timeval tv; |
| 55 | // gettimeofday(&tv, NULL); |
| 56 | // |
| 57 | // Timestamp timestamp; |
| 58 | // timestamp.set_seconds(tv.tv_sec); |
| 59 | // timestamp.set_nanos(tv.tv_usec * 1000); |
| 60 | // |
| 61 | // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. |
| 62 | // |
| 63 | // FILETIME ft; |
| 64 | // GetSystemTimeAsFileTime(&ft); |
| 65 | // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; |
| 66 | // |
| 67 | // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z |
| 68 | // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. |
| 69 | // Timestamp timestamp; |
| 70 | // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); |
| 71 | // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); |
| 72 | // |
| 73 | // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. |
| 74 | // |
| 75 | // long millis = System.currentTimeMillis(); |
| 76 | // |
| 77 | // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) |
| 78 | // .setNanos((int) ((millis % 1000) * 1000000)).build(); |
| 79 | // |
| 80 | // |
| 81 | // Example 5: Compute Timestamp from current time in Python. |
| 82 | // |
| 83 | // now = time.time() |
| 84 | // seconds = int(now) |
| 85 | // nanos = int((now - seconds) * 10**9) |
| 86 | // timestamp = Timestamp(seconds=seconds, nanos=nanos) |
| 87 | @interface GPBTimestamp : GPBMessage |
| 88 | |
| 89 | // Represents seconds of UTC time since Unix epoch |
| 90 | // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to |
| 91 | // 9999-12-31T23:59:59Z inclusive. |
| 92 | @property(nonatomic, readwrite) int64_t seconds; |
| 93 | |
| 94 | // Non-negative fractions of a second at nanosecond resolution. Negative |
| 95 | // second values with fractions must still have non-negative nanos values |
| 96 | // that count forward in time. Must be from 0 to 999,999,999 |
| 97 | // inclusive. |
| 98 | @property(nonatomic, readwrite) int32_t nanos; |
| 99 | |
| 100 | @end |
| 101 | |
| 102 | NS_ASSUME_NONNULL_END |
| 103 | |
| 104 | CF_EXTERN_C_END |
| 105 | |
| 106 | // @@protoc_insertion_point(global_scope) |