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