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