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.

167 lines
5.9 KiB

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