1 // Generated by the protocol buffer compiler. DO NOT EDIT! 2 // source: google/protobuf/timestamp.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/timestamp.proto</summary> 13 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 14 public static partial class TimestampReflection { 15 16 #region Descriptor 17 /// <summary>File descriptor for google/protobuf/timestamp.proto</summary> 18 public static pbr::FileDescriptor Descriptor { 19 get { return descriptor; } 20 } 21 private static pbr::FileDescriptor descriptor; 22 TimestampReflection()23 static TimestampReflection() { 24 byte[] descriptorData = global::System.Convert.FromBase64String( 25 string.Concat( 26 "Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJv", 27 "dG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MY", 28 "AiABKAVCgQEKE2NvbS5nb29nbGUucHJvdG9idWZCDlRpbWVzdGFtcFByb3Rv", 29 "UAFaK2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy90aW1lc3Rh", 30 "bXCgAQH4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlw", 31 "ZXNiBnByb3RvMw==")); 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.Timestamp), global::Google.Protobuf.WellKnownTypes.Timestamp.Parser, new[]{ "Seconds", "Nanos" }, null, null, null) 36 })); 37 } 38 #endregion 39 40 } 41 #region Messages 42 /// <summary> 43 /// A Timestamp represents a point in time independent of any time zone 44 /// or calendar, represented as seconds and fractions of seconds at 45 /// nanosecond resolution in UTC Epoch time. It is encoded using the 46 /// Proleptic Gregorian Calendar which extends the Gregorian calendar 47 /// backwards to year one. It is encoded assuming all minutes are 60 48 /// seconds long, i.e. leap seconds are "smeared" so that no leap second 49 /// table is needed for interpretation. Range is from 50 /// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. 51 /// By restricting to that range, we ensure that we can convert to 52 /// and from RFC 3339 date strings. 53 /// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). 54 /// 55 /// Example 1: Compute Timestamp from POSIX `time()`. 56 /// 57 /// Timestamp timestamp; 58 /// timestamp.set_seconds(time(NULL)); 59 /// timestamp.set_nanos(0); 60 /// 61 /// Example 2: Compute Timestamp from POSIX `gettimeofday()`. 62 /// 63 /// struct timeval tv; 64 /// gettimeofday(&tv, NULL); 65 /// 66 /// Timestamp timestamp; 67 /// timestamp.set_seconds(tv.tv_sec); 68 /// timestamp.set_nanos(tv.tv_usec * 1000); 69 /// 70 /// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. 71 /// 72 /// FILETIME ft; 73 /// GetSystemTimeAsFileTime(&ft); 74 /// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; 75 /// 76 /// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z 77 /// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. 78 /// Timestamp timestamp; 79 /// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); 80 /// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); 81 /// 82 /// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. 83 /// 84 /// long millis = System.currentTimeMillis(); 85 /// 86 /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) 87 /// .setNanos((int) ((millis % 1000) * 1000000)).build(); 88 /// 89 /// Example 5: Compute Timestamp from current time in Python. 90 /// 91 /// now = time.time() 92 /// seconds = int(now) 93 /// nanos = int((now - seconds) * 10**9) 94 /// timestamp = Timestamp(seconds=seconds, nanos=nanos) 95 /// </summary> 96 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 97 public sealed partial class Timestamp : pb::IMessage<Timestamp> { 98 private static readonly pb::MessageParser<Timestamp> _parser = new pb::MessageParser<Timestamp>(() => new Timestamp()); 99 public static pb::MessageParser<Timestamp> Parser { get { return _parser; } } 100 101 public static pbr::MessageDescriptor Descriptor { 102 get { return global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor.MessageTypes[0]; } 103 } 104 105 pbr::MessageDescriptor pb::IMessage.Descriptor { 106 get { return Descriptor; } 107 } 108 Timestamp()109 public Timestamp() { 110 OnConstruction(); 111 } 112 OnConstruction()113 partial void OnConstruction(); 114 Timestamp(Timestamp other)115 public Timestamp(Timestamp other) : this() { 116 seconds_ = other.seconds_; 117 nanos_ = other.nanos_; 118 } 119 Clone()120 public Timestamp Clone() { 121 return new Timestamp(this); 122 } 123 124 /// <summary>Field number for the "seconds" field.</summary> 125 public const int SecondsFieldNumber = 1; 126 private long seconds_; 127 /// <summary> 128 /// Represents seconds of UTC time since Unix epoch 129 /// 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to 130 /// 9999-12-31T23:59:59Z inclusive. 131 /// </summary> 132 public long Seconds { 133 get { return seconds_; } 134 set { 135 seconds_ = value; 136 } 137 } 138 139 /// <summary>Field number for the "nanos" field.</summary> 140 public const int NanosFieldNumber = 2; 141 private int nanos_; 142 /// <summary> 143 /// Non-negative fractions of a second at nanosecond resolution. Negative 144 /// second values with fractions must still have non-negative nanos values 145 /// that count forward in time. Must be from 0 to 999,999,999 146 /// inclusive. 147 /// </summary> 148 public int Nanos { 149 get { return nanos_; } 150 set { 151 nanos_ = value; 152 } 153 } 154 Equals(object other)155 public override bool Equals(object other) { 156 return Equals(other as Timestamp); 157 } 158 Equals(Timestamp other)159 public bool Equals(Timestamp other) { 160 if (ReferenceEquals(other, null)) { 161 return false; 162 } 163 if (ReferenceEquals(other, this)) { 164 return true; 165 } 166 if (Seconds != other.Seconds) return false; 167 if (Nanos != other.Nanos) return false; 168 return true; 169 } 170 GetHashCode()171 public override int GetHashCode() { 172 int hash = 1; 173 if (Seconds != 0L) hash ^= Seconds.GetHashCode(); 174 if (Nanos != 0) hash ^= Nanos.GetHashCode(); 175 return hash; 176 } 177 ToString()178 public override string ToString() { 179 return pb::JsonFormatter.ToDiagnosticString(this); 180 } 181 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 CalculateSize()193 public int CalculateSize() { 194 int size = 0; 195 if (Seconds != 0L) { 196 size += 1 + pb::CodedOutputStream.ComputeInt64Size(Seconds); 197 } 198 if (Nanos != 0) { 199 size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos); 200 } 201 return size; 202 } 203 MergeFrom(Timestamp other)204 public void MergeFrom(Timestamp other) { 205 if (other == null) { 206 return; 207 } 208 if (other.Seconds != 0L) { 209 Seconds = other.Seconds; 210 } 211 if (other.Nanos != 0) { 212 Nanos = other.Nanos; 213 } 214 } 215 MergeFrom(pb::CodedInputStream input)216 public void MergeFrom(pb::CodedInputStream input) { 217 uint tag; 218 while ((tag = input.ReadTag()) != 0) { 219 switch(tag) { 220 default: 221 input.SkipLastField(); 222 break; 223 case 8: { 224 Seconds = input.ReadInt64(); 225 break; 226 } 227 case 16: { 228 Nanos = input.ReadInt32(); 229 break; 230 } 231 } 232 } 233 } 234 235 } 236 237 #endregion 238 239 } 240 241 #endregion Designer generated code 242