1 // <auto-generated> 2 // Generated by the protocol buffer compiler. DO NOT EDIT! 3 // source: google/protobuf/duration.proto 4 // </auto-generated> 5 #pragma warning disable 1591, 0612, 3021 6 #region Designer generated code 7 8 using pb = global::Google.Protobuf; 9 using pbc = global::Google.Protobuf.Collections; 10 using pbr = global::Google.Protobuf.Reflection; 11 using scg = global::System.Collections.Generic; 12 namespace Google.Protobuf.WellKnownTypes { 13 14 /// <summary>Holder for reflection information generated from google/protobuf/duration.proto</summary> 15 public static partial class DurationReflection { 16 17 #region Descriptor 18 /// <summary>File descriptor for google/protobuf/duration.proto</summary> 19 public static pbr::FileDescriptor Descriptor { 20 get { return descriptor; } 21 } 22 private static pbr::FileDescriptor descriptor; 23 DurationReflection()24 static DurationReflection() { 25 byte[] descriptorData = global::System.Convert.FromBase64String( 26 string.Concat( 27 "Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90", 28 "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg", 29 "ASgFQnwKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAVoq", 30 "Z2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL2R1cmF0aW9u+AEB", 31 "ogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90", 32 "bzM=")); 33 descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, 34 new pbr::FileDescriptor[] { }, 35 new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { 36 new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.WellKnownTypes.Duration), global::Google.Protobuf.WellKnownTypes.Duration.Parser, new[]{ "Seconds", "Nanos" }, null, null, null, null) 37 })); 38 } 39 #endregion 40 41 } 42 #region Messages 43 /// <summary> 44 /// A Duration represents a signed, fixed-length span of time represented 45 /// as a count of seconds and fractions of seconds at nanosecond 46 /// resolution. It is independent of any calendar and concepts like "day" 47 /// or "month". It is related to Timestamp in that the difference between 48 /// two Timestamp values is a Duration and it can be added or subtracted 49 /// from a Timestamp. Range is approximately +-10,000 years. 50 /// 51 /// # Examples 52 /// 53 /// Example 1: Compute Duration from two Timestamps in pseudo code. 54 /// 55 /// Timestamp start = ...; 56 /// Timestamp end = ...; 57 /// Duration duration = ...; 58 /// 59 /// duration.seconds = end.seconds - start.seconds; 60 /// duration.nanos = end.nanos - start.nanos; 61 /// 62 /// if (duration.seconds < 0 && duration.nanos > 0) { 63 /// duration.seconds += 1; 64 /// duration.nanos -= 1000000000; 65 /// } else if (duration.seconds > 0 && duration.nanos < 0) { 66 /// duration.seconds -= 1; 67 /// duration.nanos += 1000000000; 68 /// } 69 /// 70 /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. 71 /// 72 /// Timestamp start = ...; 73 /// Duration duration = ...; 74 /// Timestamp end = ...; 75 /// 76 /// end.seconds = start.seconds + duration.seconds; 77 /// end.nanos = start.nanos + duration.nanos; 78 /// 79 /// if (end.nanos < 0) { 80 /// end.seconds -= 1; 81 /// end.nanos += 1000000000; 82 /// } else if (end.nanos >= 1000000000) { 83 /// end.seconds += 1; 84 /// end.nanos -= 1000000000; 85 /// } 86 /// 87 /// Example 3: Compute Duration from datetime.timedelta in Python. 88 /// 89 /// td = datetime.timedelta(days=3, minutes=10) 90 /// duration = Duration() 91 /// duration.FromTimedelta(td) 92 /// 93 /// # JSON Mapping 94 /// 95 /// In JSON format, the Duration type is encoded as a string rather than an 96 /// object, where the string ends in the suffix "s" (indicating seconds) and 97 /// is preceded by the number of seconds, with nanoseconds expressed as 98 /// fractional seconds. For example, 3 seconds with 0 nanoseconds should be 99 /// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should 100 /// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 101 /// microsecond should be expressed in JSON format as "3.000001s". 102 /// </summary> 103 public sealed partial class Duration : pb::IMessage<Duration> 104 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 105 , pb::IBufferMessage 106 #endif 107 { 108 private static readonly pb::MessageParser<Duration> _parser = new pb::MessageParser<Duration>(() => new Duration()); 109 private pb::UnknownFieldSet _unknownFields; 110 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 111 public static pb::MessageParser<Duration> Parser { get { return _parser; } } 112 113 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 114 public static pbr::MessageDescriptor Descriptor { 115 get { return global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor.MessageTypes[0]; } 116 } 117 118 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 119 pbr::MessageDescriptor pb::IMessage.Descriptor { 120 get { return Descriptor; } 121 } 122 123 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] Duration()124 public Duration() { 125 OnConstruction(); 126 } 127 OnConstruction()128 partial void OnConstruction(); 129 130 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] Duration(Duration other)131 public Duration(Duration other) : this() { 132 seconds_ = other.seconds_; 133 nanos_ = other.nanos_; 134 _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); 135 } 136 137 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] Clone()138 public Duration Clone() { 139 return new Duration(this); 140 } 141 142 /// <summary>Field number for the "seconds" field.</summary> 143 public const int SecondsFieldNumber = 1; 144 private long seconds_; 145 /// <summary> 146 /// Signed seconds of the span of time. Must be from -315,576,000,000 147 /// to +315,576,000,000 inclusive. Note: these bounds are computed from: 148 /// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years 149 /// </summary> 150 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 151 public long Seconds { 152 get { return seconds_; } 153 set { 154 seconds_ = value; 155 } 156 } 157 158 /// <summary>Field number for the "nanos" field.</summary> 159 public const int NanosFieldNumber = 2; 160 private int nanos_; 161 /// <summary> 162 /// Signed fractions of a second at nanosecond resolution of the span 163 /// of time. Durations less than one second are represented with a 0 164 /// `seconds` field and a positive or negative `nanos` field. For durations 165 /// of one second or more, a non-zero value for the `nanos` field must be 166 /// of the same sign as the `seconds` field. Must be from -999,999,999 167 /// to +999,999,999 inclusive. 168 /// </summary> 169 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 170 public int Nanos { 171 get { return nanos_; } 172 set { 173 nanos_ = value; 174 } 175 } 176 177 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] Equals(object other)178 public override bool Equals(object other) { 179 return Equals(other as Duration); 180 } 181 182 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] Equals(Duration other)183 public bool Equals(Duration other) { 184 if (ReferenceEquals(other, null)) { 185 return false; 186 } 187 if (ReferenceEquals(other, this)) { 188 return true; 189 } 190 if (Seconds != other.Seconds) return false; 191 if (Nanos != other.Nanos) return false; 192 return Equals(_unknownFields, other._unknownFields); 193 } 194 195 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] GetHashCode()196 public override int GetHashCode() { 197 int hash = 1; 198 if (Seconds != 0L) hash ^= Seconds.GetHashCode(); 199 if (Nanos != 0) hash ^= Nanos.GetHashCode(); 200 if (_unknownFields != null) { 201 hash ^= _unknownFields.GetHashCode(); 202 } 203 return hash; 204 } 205 206 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] ToString()207 public override string ToString() { 208 return pb::JsonFormatter.ToDiagnosticString(this); 209 } 210 211 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] WriteTo(pb::CodedOutputStream output)212 public void WriteTo(pb::CodedOutputStream output) { 213 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 214 output.WriteRawMessage(this); 215 #else 216 if (Seconds != 0L) { 217 output.WriteRawTag(8); 218 output.WriteInt64(Seconds); 219 } 220 if (Nanos != 0) { 221 output.WriteRawTag(16); 222 output.WriteInt32(Nanos); 223 } 224 if (_unknownFields != null) { 225 _unknownFields.WriteTo(output); 226 } 227 #endif 228 } 229 230 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 231 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] IBufferMessage.InternalWriteTo(ref pb::WriteContext output)232 void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { 233 if (Seconds != 0L) { 234 output.WriteRawTag(8); 235 output.WriteInt64(Seconds); 236 } 237 if (Nanos != 0) { 238 output.WriteRawTag(16); 239 output.WriteInt32(Nanos); 240 } 241 if (_unknownFields != null) { 242 _unknownFields.WriteTo(ref output); 243 } 244 } 245 #endif 246 247 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] CalculateSize()248 public int CalculateSize() { 249 int size = 0; 250 if (Seconds != 0L) { 251 size += 1 + pb::CodedOutputStream.ComputeInt64Size(Seconds); 252 } 253 if (Nanos != 0) { 254 size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos); 255 } 256 if (_unknownFields != null) { 257 size += _unknownFields.CalculateSize(); 258 } 259 return size; 260 } 261 262 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] MergeFrom(Duration other)263 public void MergeFrom(Duration other) { 264 if (other == null) { 265 return; 266 } 267 if (other.Seconds != 0L) { 268 Seconds = other.Seconds; 269 } 270 if (other.Nanos != 0) { 271 Nanos = other.Nanos; 272 } 273 _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); 274 } 275 276 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] MergeFrom(pb::CodedInputStream input)277 public void MergeFrom(pb::CodedInputStream input) { 278 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 279 input.ReadRawMessage(this); 280 #else 281 uint tag; 282 while ((tag = input.ReadTag()) != 0) { 283 switch(tag) { 284 default: 285 _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); 286 break; 287 case 8: { 288 Seconds = input.ReadInt64(); 289 break; 290 } 291 case 16: { 292 Nanos = input.ReadInt32(); 293 break; 294 } 295 } 296 } 297 #endif 298 } 299 300 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 301 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] IBufferMessage.InternalMergeFrom(ref pb::ParseContext input)302 void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { 303 uint tag; 304 while ((tag = input.ReadTag()) != 0) { 305 switch(tag) { 306 default: 307 _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); 308 break; 309 case 8: { 310 Seconds = input.ReadInt64(); 311 break; 312 } 313 case 16: { 314 Nanos = input.ReadInt32(); 315 break; 316 } 317 } 318 } 319 } 320 #endif 321 322 } 323 324 #endregion 325 326 } 327 328 #endregion Designer generated code 329