Timestamp.pbobjc.h 3.5 KB

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