You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
5.5 KiB

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