Thomas Van Lenten | 56c48ae | 2020-01-22 15:50:52 -0500 | [diff] [blame] | 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! |
Thomas Van Lenten | 7c64628 | 2022-09-19 13:19:31 -0400 | [diff] [blame] | 2 | // clang-format off |
Thomas Van Lenten | 672adeb | 2022-10-06 16:16:07 -0400 | [diff] [blame] | 3 | // source: google/protobuf/duration.proto |
Thomas Van Lenten | 7c64628 | 2022-09-19 13:19:31 -0400 | [diff] [blame] | 4 | |
Thomas Van Lenten | 020e4e3 | 2022-03-01 14:16:50 -0500 | [diff] [blame] | 5 | #import "GPBDescriptor.h" |
| 6 | #import "GPBMessage.h" |
| 7 | #import "GPBRootObject.h" |
Thomas Van Lenten | 56c48ae | 2020-01-22 15:50:52 -0500 | [diff] [blame] | 8 | |
Protobuf Team Bot | 4ed02cc | 2023-02-08 06:31:58 -0800 | [diff] [blame] | 9 | #if GOOGLE_PROTOBUF_OBJC_VERSION < 30007 |
Thomas Van Lenten | 56c48ae | 2020-01-22 15:50:52 -0500 | [diff] [blame] | 10 | #error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. |
| 11 | #endif |
Protobuf Team Bot | 4ed02cc | 2023-02-08 06:31:58 -0800 | [diff] [blame] | 12 | #if 30007 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION |
Thomas Van Lenten | 56c48ae | 2020-01-22 15:50:52 -0500 | [diff] [blame] | 13 | #error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. |
| 14 | #endif |
| 15 | |
| 16 | // @@protoc_insertion_point(imports) |
| 17 | |
| 18 | #pragma clang diagnostic push |
| 19 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" |
| 20 | |
| 21 | CF_EXTERN_C_BEGIN |
| 22 | |
| 23 | NS_ASSUME_NONNULL_BEGIN |
| 24 | |
| 25 | #pragma mark - GPBDurationRoot |
| 26 | |
| 27 | /** |
| 28 | * Exposes the extension registry for this file. |
| 29 | * |
| 30 | * The base class provides: |
| 31 | * @code |
| 32 | * + (GPBExtensionRegistry *)extensionRegistry; |
| 33 | * @endcode |
| 34 | * which is a @c GPBExtensionRegistry that includes all the extensions defined by |
| 35 | * this file and all files that it depends on. |
| 36 | **/ |
| 37 | GPB_FINAL @interface GPBDurationRoot : GPBRootObject |
| 38 | @end |
| 39 | |
| 40 | #pragma mark - GPBDuration |
| 41 | |
| 42 | typedef GPB_ENUM(GPBDuration_FieldNumber) { |
| 43 | GPBDuration_FieldNumber_Seconds = 1, |
| 44 | GPBDuration_FieldNumber_Nanos = 2, |
| 45 | }; |
| 46 | |
| 47 | /** |
| 48 | * A Duration represents a signed, fixed-length span of time represented |
| 49 | * as a count of seconds and fractions of seconds at nanosecond |
| 50 | * resolution. It is independent of any calendar and concepts like "day" |
| 51 | * or "month". It is related to Timestamp in that the difference between |
| 52 | * two Timestamp values is a Duration and it can be added or subtracted |
| 53 | * from a Timestamp. Range is approximately +-10,000 years. |
| 54 | * |
| 55 | * # Examples |
| 56 | * |
| 57 | * Example 1: Compute Duration from two Timestamps in pseudo code. |
| 58 | * |
| 59 | * Timestamp start = ...; |
| 60 | * Timestamp end = ...; |
| 61 | * Duration duration = ...; |
| 62 | * |
| 63 | * duration.seconds = end.seconds - start.seconds; |
| 64 | * duration.nanos = end.nanos - start.nanos; |
| 65 | * |
| 66 | * if (duration.seconds < 0 && duration.nanos > 0) { |
| 67 | * duration.seconds += 1; |
| 68 | * duration.nanos -= 1000000000; |
| 69 | * } else if (duration.seconds > 0 && duration.nanos < 0) { |
| 70 | * duration.seconds -= 1; |
| 71 | * duration.nanos += 1000000000; |
| 72 | * } |
| 73 | * |
| 74 | * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. |
| 75 | * |
| 76 | * Timestamp start = ...; |
| 77 | * Duration duration = ...; |
| 78 | * Timestamp end = ...; |
| 79 | * |
| 80 | * end.seconds = start.seconds + duration.seconds; |
| 81 | * end.nanos = start.nanos + duration.nanos; |
| 82 | * |
| 83 | * if (end.nanos < 0) { |
| 84 | * end.seconds -= 1; |
| 85 | * end.nanos += 1000000000; |
| 86 | * } else if (end.nanos >= 1000000000) { |
| 87 | * end.seconds += 1; |
| 88 | * end.nanos -= 1000000000; |
| 89 | * } |
| 90 | * |
| 91 | * Example 3: Compute Duration from datetime.timedelta in Python. |
| 92 | * |
| 93 | * td = datetime.timedelta(days=3, minutes=10) |
| 94 | * duration = Duration() |
| 95 | * duration.FromTimedelta(td) |
| 96 | * |
| 97 | * # JSON Mapping |
| 98 | * |
| 99 | * In JSON format, the Duration type is encoded as a string rather than an |
| 100 | * object, where the string ends in the suffix "s" (indicating seconds) and |
| 101 | * is preceded by the number of seconds, with nanoseconds expressed as |
| 102 | * fractional seconds. For example, 3 seconds with 0 nanoseconds should be |
| 103 | * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should |
| 104 | * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 |
| 105 | * microsecond should be expressed in JSON format as "3.000001s". |
| 106 | **/ |
| 107 | GPB_FINAL @interface GPBDuration : GPBMessage |
| 108 | |
| 109 | /** |
| 110 | * Signed seconds of the span of time. Must be from -315,576,000,000 |
| 111 | * to +315,576,000,000 inclusive. Note: these bounds are computed from: |
| 112 | * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years |
| 113 | **/ |
| 114 | @property(nonatomic, readwrite) int64_t seconds; |
| 115 | |
| 116 | /** |
| 117 | * Signed fractions of a second at nanosecond resolution of the span |
| 118 | * of time. Durations less than one second are represented with a 0 |
| 119 | * `seconds` field and a positive or negative `nanos` field. For durations |
| 120 | * of one second or more, a non-zero value for the `nanos` field must be |
| 121 | * of the same sign as the `seconds` field. Must be from -999,999,999 |
| 122 | * to +999,999,999 inclusive. |
| 123 | **/ |
| 124 | @property(nonatomic, readwrite) int32_t nanos; |
| 125 | |
| 126 | @end |
| 127 | |
| 128 | NS_ASSUME_NONNULL_END |
| 129 | |
| 130 | CF_EXTERN_C_END |
| 131 | |
| 132 | #pragma clang diagnostic pop |
| 133 | |
| 134 | // @@protoc_insertion_point(global_scope) |
Thomas Van Lenten | 7c64628 | 2022-09-19 13:19:31 -0400 | [diff] [blame] | 135 | |
Protobuf Team Bot | 4df096f | 2022-12-01 09:00:00 -0800 | [diff] [blame] | 136 | // clang-format on |