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.

145 lines
4.6 KiB

  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: google/protobuf/duration.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 - GPBDurationRoot
  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 GPBDurationRoot : GPBRootObject
  40. @end
  41. #pragma mark - GPBDuration
  42. typedef GPB_ENUM(GPBDuration_FieldNumber) {
  43. GPBDuration_FieldNumber_Seconds = 1,
  44. GPBDuration_FieldNumber_Nanos = 2,
  45. };
  46. /**
  47. * A Duration represents a signed, fixed-length span of time represented
  48. * as a count of seconds and fractions of seconds at nanosecond
  49. * resolution. It is independent of any calendar and concepts like "day"
  50. * or "month". It is related to Timestamp in that the difference between
  51. * two Timestamp values is a Duration and it can be added or subtracted
  52. * from a Timestamp. Range is approximately +-10,000 years.
  53. *
  54. * # Examples
  55. *
  56. * Example 1: Compute Duration from two Timestamps in pseudo code.
  57. *
  58. * Timestamp start = ...;
  59. * Timestamp end = ...;
  60. * Duration duration = ...;
  61. *
  62. * duration.seconds = end.seconds - start.seconds;
  63. * duration.nanos = end.nanos - start.nanos;
  64. *
  65. * if (duration.seconds < 0 && duration.nanos > 0) {
  66. * duration.seconds += 1;
  67. * duration.nanos -= 1000000000;
  68. * } else if (duration.seconds > 0 && duration.nanos < 0) {
  69. * duration.seconds -= 1;
  70. * duration.nanos += 1000000000;
  71. * }
  72. *
  73. * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
  74. *
  75. * Timestamp start = ...;
  76. * Duration duration = ...;
  77. * Timestamp end = ...;
  78. *
  79. * end.seconds = start.seconds + duration.seconds;
  80. * end.nanos = start.nanos + duration.nanos;
  81. *
  82. * if (end.nanos < 0) {
  83. * end.seconds -= 1;
  84. * end.nanos += 1000000000;
  85. * } else if (end.nanos >= 1000000000) {
  86. * end.seconds += 1;
  87. * end.nanos -= 1000000000;
  88. * }
  89. *
  90. * Example 3: Compute Duration from datetime.timedelta in Python.
  91. *
  92. * td = datetime.timedelta(days=3, minutes=10)
  93. * duration = Duration()
  94. * duration.FromTimedelta(td)
  95. *
  96. * # JSON Mapping
  97. *
  98. * In JSON format, the Duration type is encoded as a string rather than an
  99. * object, where the string ends in the suffix "s" (indicating seconds) and
  100. * is preceded by the number of seconds, with nanoseconds expressed as
  101. * fractional seconds. For example, 3 seconds with 0 nanoseconds should be
  102. * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
  103. * be expressed in JSON format as "3.000000001s", and 3 seconds and 1
  104. * microsecond should be expressed in JSON format as "3.000001s".
  105. **/
  106. GPB_FINAL @interface GPBDuration : GPBMessage
  107. /**
  108. * Signed seconds of the span of time. Must be from -315,576,000,000
  109. * to +315,576,000,000 inclusive. Note: these bounds are computed from:
  110. * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
  111. **/
  112. @property(nonatomic, readwrite) int64_t seconds;
  113. /**
  114. * Signed fractions of a second at nanosecond resolution of the span
  115. * of time. Durations less than one second are represented with a 0
  116. * `seconds` field and a positive or negative `nanos` field. For durations
  117. * of one second or more, a non-zero value for the `nanos` field must be
  118. * of the same sign as the `seconds` field. Must be from -999,999,999
  119. * to +999,999,999 inclusive.
  120. **/
  121. @property(nonatomic, readwrite) int32_t nanos;
  122. @end
  123. NS_ASSUME_NONNULL_END
  124. CF_EXTERN_C_END
  125. #pragma clang diagnostic pop
  126. // @@protoc_insertion_point(global_scope)