Duration.pbobjc.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: google/protobuf/duration.proto
  3. #import "GPBProtocolBuffers.h"
  4. #if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30001
  5. #error This file was generated by a different version of protoc which is incompatible with your Protocol Buffer library sources.
  6. #endif
  7. // @@protoc_insertion_point(imports)
  8. #pragma clang diagnostic push
  9. #pragma clang diagnostic ignored "-Wdeprecated-declarations"
  10. CF_EXTERN_C_BEGIN
  11. NS_ASSUME_NONNULL_BEGIN
  12. #pragma mark - GPBDurationRoot
  13. /// Exposes the extension registry for this file.
  14. ///
  15. /// The base class provides:
  16. /// @code
  17. /// + (GPBExtensionRegistry *)extensionRegistry;
  18. /// @endcode
  19. /// which is a @c GPBExtensionRegistry that includes all the extensions defined by
  20. /// this file and all files that it depends on.
  21. @interface GPBDurationRoot : GPBRootObject
  22. @end
  23. #pragma mark - GPBDuration
  24. typedef GPB_ENUM(GPBDuration_FieldNumber) {
  25. GPBDuration_FieldNumber_Seconds = 1,
  26. GPBDuration_FieldNumber_Nanos = 2,
  27. };
  28. /// A Duration represents a signed, fixed-length span of time represented
  29. /// as a count of seconds and fractions of seconds at nanosecond
  30. /// resolution. It is independent of any calendar and concepts like "day"
  31. /// or "month". It is related to Timestamp in that the difference between
  32. /// two Timestamp values is a Duration and it can be added or subtracted
  33. /// from a Timestamp. Range is approximately +-10,000 years.
  34. ///
  35. /// Example 1: Compute Duration from two Timestamps in pseudo code.
  36. ///
  37. /// Timestamp start = ...;
  38. /// Timestamp end = ...;
  39. /// Duration duration = ...;
  40. ///
  41. /// duration.seconds = end.seconds - start.seconds;
  42. /// duration.nanos = end.nanos - start.nanos;
  43. ///
  44. /// if (duration.seconds < 0 && duration.nanos > 0) {
  45. /// duration.seconds += 1;
  46. /// duration.nanos -= 1000000000;
  47. /// } else if (durations.seconds > 0 && duration.nanos < 0) {
  48. /// duration.seconds -= 1;
  49. /// duration.nanos += 1000000000;
  50. /// }
  51. ///
  52. /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
  53. ///
  54. /// Timestamp start = ...;
  55. /// Duration duration = ...;
  56. /// Timestamp end = ...;
  57. ///
  58. /// end.seconds = start.seconds + duration.seconds;
  59. /// end.nanos = start.nanos + duration.nanos;
  60. ///
  61. /// if (end.nanos < 0) {
  62. /// end.seconds -= 1;
  63. /// end.nanos += 1000000000;
  64. /// } else if (end.nanos >= 1000000000) {
  65. /// end.seconds += 1;
  66. /// end.nanos -= 1000000000;
  67. /// }
  68. @interface GPBDuration : GPBMessage
  69. /// Signed seconds of the span of time. Must be from -315,576,000,000
  70. /// to +315,576,000,000 inclusive.
  71. @property(nonatomic, readwrite) int64_t seconds;
  72. /// Signed fractions of a second at nanosecond resolution of the span
  73. /// of time. Durations less than one second are represented with a 0
  74. /// `seconds` field and a positive or negative `nanos` field. For durations
  75. /// of one second or more, a non-zero value for the `nanos` field must be
  76. /// of the same sign as the `seconds` field. Must be from -999,999,999
  77. /// to +999,999,999 inclusive.
  78. @property(nonatomic, readwrite) int32_t nanos;
  79. @end
  80. NS_ASSUME_NONNULL_END
  81. CF_EXTERN_C_END
  82. #pragma clang diagnostic pop
  83. // @@protoc_insertion_point(global_scope)