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