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