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