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, 8981 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 "ASgFQoMBChNjb20uZ29vZ2xlLnByb3RvYnVmQg1EdXJhdGlvblByb3RvUAFa", 30 "MWdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL2R1cmF0", 31 "aW9ucGL4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlw", 32 "ZXNiBnByb3RvMw==")); 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 [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] 104 public sealed partial class Duration : pb::IMessage<Duration> 105 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 106 , pb::IBufferMessage 107 #endif 108 { 109 private static readonly pb::MessageParser<Duration> _parser = new pb::MessageParser<Duration>(() => new Duration()); 110 private pb::UnknownFieldSet _unknownFields; 111 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 112 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 113 public static pb::MessageParser<Duration> Parser { get { return _parser; } } 114 115 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 116 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 117 public static pbr::MessageDescriptor Descriptor { 118 get { return global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor.MessageTypes[0]; } 119 } 120 121 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 122 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 123 pbr::MessageDescriptor pb::IMessage.Descriptor { 124 get { return Descriptor; } 125 } 126 127 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 128 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Duration()129 public Duration() { 130 OnConstruction(); 131 } 132 OnConstruction()133 partial void OnConstruction(); 134 135 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 136 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Duration(Duration other)137 public Duration(Duration other) : this() { 138 seconds_ = other.seconds_; 139 nanos_ = other.nanos_; 140 _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); 141 } 142 143 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 144 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Clone()145 public Duration Clone() { 146 return new Duration(this); 147 } 148 149 /// <summary>Field number for the "seconds" field.</summary> 150 public const int SecondsFieldNumber = 1; 151 private long seconds_; 152 /// <summary> 153 /// Signed seconds of the span of time. Must be from -315,576,000,000 154 /// to +315,576,000,000 inclusive. Note: these bounds are computed from: 155 /// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years 156 /// </summary> 157 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 158 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 159 public long Seconds { 160 get { return seconds_; } 161 set { 162 seconds_ = value; 163 } 164 } 165 166 /// <summary>Field number for the "nanos" field.</summary> 167 public const int NanosFieldNumber = 2; 168 private int nanos_; 169 /// <summary> 170 /// Signed fractions of a second at nanosecond resolution of the span 171 /// of time. Durations less than one second are represented with a 0 172 /// `seconds` field and a positive or negative `nanos` field. For durations 173 /// of one second or more, a non-zero value for the `nanos` field must be 174 /// of the same sign as the `seconds` field. Must be from -999,999,999 175 /// to +999,999,999 inclusive. 176 /// </summary> 177 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 178 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] 179 public int Nanos { 180 get { return nanos_; } 181 set { 182 nanos_ = value; 183 } 184 } 185 186 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 187 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Equals(object other)188 public override bool Equals(object other) { 189 return Equals(other as Duration); 190 } 191 192 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 193 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] Equals(Duration other)194 public bool Equals(Duration other) { 195 if (ReferenceEquals(other, null)) { 196 return false; 197 } 198 if (ReferenceEquals(other, this)) { 199 return true; 200 } 201 if (Seconds != other.Seconds) return false; 202 if (Nanos != other.Nanos) return false; 203 return Equals(_unknownFields, other._unknownFields); 204 } 205 206 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 207 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] GetHashCode()208 public override int GetHashCode() { 209 int hash = 1; 210 if (Seconds != 0L) hash ^= Seconds.GetHashCode(); 211 if (Nanos != 0) hash ^= Nanos.GetHashCode(); 212 if (_unknownFields != null) { 213 hash ^= _unknownFields.GetHashCode(); 214 } 215 return hash; 216 } 217 218 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 219 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] ToString()220 public override string ToString() { 221 return pb::JsonFormatter.ToDiagnosticString(this); 222 } 223 224 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 225 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] WriteTo(pb::CodedOutputStream output)226 public void WriteTo(pb::CodedOutputStream output) { 227 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 228 output.WriteRawMessage(this); 229 #else 230 if (Seconds != 0L) { 231 output.WriteRawTag(8); 232 output.WriteInt64(Seconds); 233 } 234 if (Nanos != 0) { 235 output.WriteRawTag(16); 236 output.WriteInt32(Nanos); 237 } 238 if (_unknownFields != null) { 239 _unknownFields.WriteTo(output); 240 } 241 #endif 242 } 243 244 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 245 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 246 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] IBufferMessage.InternalWriteTo(ref pb::WriteContext output)247 void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { 248 if (Seconds != 0L) { 249 output.WriteRawTag(8); 250 output.WriteInt64(Seconds); 251 } 252 if (Nanos != 0) { 253 output.WriteRawTag(16); 254 output.WriteInt32(Nanos); 255 } 256 if (_unknownFields != null) { 257 _unknownFields.WriteTo(ref output); 258 } 259 } 260 #endif 261 262 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 263 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] CalculateSize()264 public int CalculateSize() { 265 int size = 0; 266 if (Seconds != 0L) { 267 size += 1 + pb::CodedOutputStream.ComputeInt64Size(Seconds); 268 } 269 if (Nanos != 0) { 270 size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos); 271 } 272 if (_unknownFields != null) { 273 size += _unknownFields.CalculateSize(); 274 } 275 return size; 276 } 277 278 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 279 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] MergeFrom(Duration other)280 public void MergeFrom(Duration other) { 281 if (other == null) { 282 return; 283 } 284 if (other.Seconds != 0L) { 285 Seconds = other.Seconds; 286 } 287 if (other.Nanos != 0) { 288 Nanos = other.Nanos; 289 } 290 _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); 291 } 292 293 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 294 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] MergeFrom(pb::CodedInputStream input)295 public void MergeFrom(pb::CodedInputStream input) { 296 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 297 input.ReadRawMessage(this); 298 #else 299 uint tag; 300 while ((tag = input.ReadTag()) != 0) { 301 if ((tag & 7) == 4) { 302 // Abort on any end group tag. 303 return; 304 } 305 switch(tag) { 306 default: 307 _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, 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 #endif 320 } 321 322 #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE 323 [global::System.Diagnostics.DebuggerNonUserCodeAttribute] 324 [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] IBufferMessage.InternalMergeFrom(ref pb::ParseContext input)325 void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { 326 uint tag; 327 while ((tag = input.ReadTag()) != 0) { 328 if ((tag & 7) == 4) { 329 // Abort on any end group tag. 330 return; 331 } 332 switch(tag) { 333 default: 334 _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); 335 break; 336 case 8: { 337 Seconds = input.ReadInt64(); 338 break; 339 } 340 case 16: { 341 Nanos = input.ReadInt32(); 342 break; 343 } 344 } 345 } 346 } 347 #endif 348 349 } 350 351 #endregion 352 353 } 354 355 #endregion Designer generated code 356