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