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 != 30001 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 #pragma clang diagnostic push 13 #pragma clang diagnostic ignored "-Wdeprecated-declarations" 14 15 CF_EXTERN_C_BEGIN 16 17 NS_ASSUME_NONNULL_BEGIN 18 19 #pragma mark - GPBTimestampRoot 20 21 /// Exposes the extension registry for this file. 22 /// 23 /// The base class provides: 24 /// @code 25 /// + (GPBExtensionRegistry *)extensionRegistry; 26 /// @endcode 27 /// which is a @c GPBExtensionRegistry that includes all the extensions defined by 28 /// this file and all files that it depends on. 29 @interface GPBTimestampRoot : GPBRootObject 30 @end 31 32 #pragma mark - GPBTimestamp 33 34 typedef GPB_ENUM(GPBTimestamp_FieldNumber) { 35 GPBTimestamp_FieldNumber_Seconds = 1, 36 GPBTimestamp_FieldNumber_Nanos = 2, 37 }; 38 39 /// A Timestamp represents a point in time independent of any time zone 40 /// or calendar, represented as seconds and fractions of seconds at 41 /// nanosecond resolution in UTC Epoch time. It is encoded using the 42 /// Proleptic Gregorian Calendar which extends the Gregorian calendar 43 /// 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 45 /// table is needed for interpretation. Range is from 46 /// 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 48 /// and from RFC 3339 date strings. 49 /// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). 50 /// 51 /// Example 1: Compute Timestamp from POSIX `time()`. 52 /// 53 /// Timestamp timestamp; 54 /// timestamp.set_seconds(time(NULL)); 55 /// timestamp.set_nanos(0); 56 /// 57 /// Example 2: Compute Timestamp from POSIX `gettimeofday()`. 58 /// 59 /// struct timeval tv; 60 /// gettimeofday(&tv, NULL); 61 /// 62 /// Timestamp timestamp; 63 /// timestamp.set_seconds(tv.tv_sec); 64 /// timestamp.set_nanos(tv.tv_usec * 1000); 65 /// 66 /// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. 67 /// 68 /// FILETIME ft; 69 /// GetSystemTimeAsFileTime(&ft); 70 /// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; 71 /// 72 /// // 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. 74 /// Timestamp timestamp; 75 /// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); 76 /// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); 77 /// 78 /// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. 79 /// 80 /// long millis = System.currentTimeMillis(); 81 /// 82 /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) 83 /// .setNanos((int) ((millis % 1000) * 1000000)).build(); 84 /// 85 /// 86 /// Example 5: Compute Timestamp from current time in Python. 87 /// 88 /// now = time.time() 89 /// seconds = int(now) 90 /// nanos = int((now - seconds) * 10**9) 91 /// timestamp = Timestamp(seconds=seconds, nanos=nanos) 92 @interface GPBTimestamp : GPBMessage 93 94 /// Represents seconds of UTC time since Unix epoch 95 /// 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to 96 /// 9999-12-31T23:59:59Z inclusive. 97 @property(nonatomic, readwrite) int64_t seconds; 98 99 /// Non-negative fractions of a second at nanosecond resolution. Negative 100 /// 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 102 /// inclusive. 103 @property(nonatomic, readwrite) int32_t nanos; 104 105 @end 106 107 NS_ASSUME_NONNULL_END 108 109 CF_EXTERN_C_END 110 111 #pragma clang diagnostic pop 112 113 // @@protoc_insertion_point(global_scope) 114