1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: google/protobuf/duration.proto
3 #pragma warning disable 1591, 0612, 3021
4 #region Designer generated code
5 
6 using pb = global::Google.Protobuf;
7 using pbc = global::Google.Protobuf.Collections;
8 using pbr = global::Google.Protobuf.Reflection;
9 using scg = global::System.Collections.Generic;
10 namespace Google.Protobuf.WellKnownTypes {
11 
12   /// <summary>Holder for reflection information generated from google/protobuf/duration.proto</summary>
13   [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
14   public static partial class DurationReflection {
15 
16     #region Descriptor
17     /// <summary>File descriptor for google/protobuf/duration.proto</summary>
18     public static pbr::FileDescriptor Descriptor {
19       get { return descriptor; }
20     }
21     private static pbr::FileDescriptor descriptor;
22 
DurationReflection()23     static DurationReflection() {
24       byte[] descriptorData = global::System.Convert.FromBase64String(
25           string.Concat(
26             "Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90",
27             "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg",
28             "ASgFQnwKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAVoq",
29             "Z2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL2R1cmF0aW9uoAEB",
30             "ogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90",
31             "bzM="));
32       descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
33           new pbr::FileDescriptor[] { },
34           new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
35             new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Duration), global::Google.Protobuf.WellKnownTypes.Duration.Parser, new[]{ "Seconds", "Nanos" }, null, null, null)
36           }));
37     }
38     #endregion
39 
40   }
41   #region Messages
42   /// <summary>
43   ///  A Duration represents a signed, fixed-length span of time represented
44   ///  as a count of seconds and fractions of seconds at nanosecond
45   ///  resolution. It is independent of any calendar and concepts like "day"
46   ///  or "month". It is related to Timestamp in that the difference between
47   ///  two Timestamp values is a Duration and it can be added or subtracted
48   ///  from a Timestamp. Range is approximately +-10,000 years.
49   ///
50   ///  Example 1: Compute Duration from two Timestamps in pseudo code.
51   ///
52   ///      Timestamp start = ...;
53   ///      Timestamp end = ...;
54   ///      Duration duration = ...;
55   ///
56   ///      duration.seconds = end.seconds - start.seconds;
57   ///      duration.nanos = end.nanos - start.nanos;
58   ///
59   ///      if (duration.seconds &lt; 0 &amp;&amp; duration.nanos > 0) {
60   ///        duration.seconds += 1;
61   ///        duration.nanos -= 1000000000;
62   ///      } else if (durations.seconds > 0 &amp;&amp; duration.nanos &lt; 0) {
63   ///        duration.seconds -= 1;
64   ///        duration.nanos += 1000000000;
65   ///      }
66   ///
67   ///  Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
68   ///
69   ///      Timestamp start = ...;
70   ///      Duration duration = ...;
71   ///      Timestamp end = ...;
72   ///
73   ///      end.seconds = start.seconds + duration.seconds;
74   ///      end.nanos = start.nanos + duration.nanos;
75   ///
76   ///      if (end.nanos &lt; 0) {
77   ///        end.seconds -= 1;
78   ///        end.nanos += 1000000000;
79   ///      } else if (end.nanos >= 1000000000) {
80   ///        end.seconds += 1;
81   ///        end.nanos -= 1000000000;
82   ///      }
83   /// </summary>
84   [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
85   public sealed partial class Duration : pb::IMessage<Duration> {
86     private static readonly pb::MessageParser<Duration> _parser = new pb::MessageParser<Duration>(() => new Duration());
87     public static pb::MessageParser<Duration> Parser { get { return _parser; } }
88 
89     public static pbr::MessageDescriptor Descriptor {
90       get { return global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor.MessageTypes[0]; }
91     }
92 
93     pbr::MessageDescriptor pb::IMessage.Descriptor {
94       get { return Descriptor; }
95     }
96 
Duration()97     public Duration() {
98       OnConstruction();
99     }
100 
OnConstruction()101     partial void OnConstruction();
102 
Duration(Duration other)103     public Duration(Duration other) : this() {
104       seconds_ = other.seconds_;
105       nanos_ = other.nanos_;
106     }
107 
Clone()108     public Duration Clone() {
109       return new Duration(this);
110     }
111 
112     /// <summary>Field number for the "seconds" field.</summary>
113     public const int SecondsFieldNumber = 1;
114     private long seconds_;
115     /// <summary>
116     ///  Signed seconds of the span of time. Must be from -315,576,000,000
117     ///  to +315,576,000,000 inclusive.
118     /// </summary>
119     public long Seconds {
120       get { return seconds_; }
121       set {
122         seconds_ = value;
123       }
124     }
125 
126     /// <summary>Field number for the "nanos" field.</summary>
127     public const int NanosFieldNumber = 2;
128     private int nanos_;
129     /// <summary>
130     ///  Signed fractions of a second at nanosecond resolution of the span
131     ///  of time. Durations less than one second are represented with a 0
132     ///  `seconds` field and a positive or negative `nanos` field. For durations
133     ///  of one second or more, a non-zero value for the `nanos` field must be
134     ///  of the same sign as the `seconds` field. Must be from -999,999,999
135     ///  to +999,999,999 inclusive.
136     /// </summary>
137     public int Nanos {
138       get { return nanos_; }
139       set {
140         nanos_ = value;
141       }
142     }
143 
Equals(object other)144     public override bool Equals(object other) {
145       return Equals(other as Duration);
146     }
147 
Equals(Duration other)148     public bool Equals(Duration other) {
149       if (ReferenceEquals(other, null)) {
150         return false;
151       }
152       if (ReferenceEquals(other, this)) {
153         return true;
154       }
155       if (Seconds != other.Seconds) return false;
156       if (Nanos != other.Nanos) return false;
157       return true;
158     }
159 
GetHashCode()160     public override int GetHashCode() {
161       int hash = 1;
162       if (Seconds != 0L) hash ^= Seconds.GetHashCode();
163       if (Nanos != 0) hash ^= Nanos.GetHashCode();
164       return hash;
165     }
166 
ToString()167     public override string ToString() {
168       return pb::JsonFormatter.ToDiagnosticString(this);
169     }
170 
WriteTo(pb::CodedOutputStream output)171     public void WriteTo(pb::CodedOutputStream output) {
172       if (Seconds != 0L) {
173         output.WriteRawTag(8);
174         output.WriteInt64(Seconds);
175       }
176       if (Nanos != 0) {
177         output.WriteRawTag(16);
178         output.WriteInt32(Nanos);
179       }
180     }
181 
CalculateSize()182     public int CalculateSize() {
183       int size = 0;
184       if (Seconds != 0L) {
185         size += 1 + pb::CodedOutputStream.ComputeInt64Size(Seconds);
186       }
187       if (Nanos != 0) {
188         size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos);
189       }
190       return size;
191     }
192 
MergeFrom(Duration other)193     public void MergeFrom(Duration other) {
194       if (other == null) {
195         return;
196       }
197       if (other.Seconds != 0L) {
198         Seconds = other.Seconds;
199       }
200       if (other.Nanos != 0) {
201         Nanos = other.Nanos;
202       }
203     }
204 
MergeFrom(pb::CodedInputStream input)205     public void MergeFrom(pb::CodedInputStream input) {
206       uint tag;
207       while ((tag = input.ReadTag()) != 0) {
208         switch(tag) {
209           default:
210             input.SkipLastField();
211             break;
212           case 8: {
213             Seconds = input.ReadInt64();
214             break;
215           }
216           case 16: {
217             Nanos = input.ReadInt32();
218             break;
219           }
220         }
221       }
222     }
223 
224   }
225 
226   #endregion
227 
228 }
229 
230 #endregion Designer generated code
231