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