Timestamp.pbobjc.h 4.1 KB

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