Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 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 | |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 12 | /// <summary>Holder for reflection information generated from google/protobuf/timestamp.proto</summary> |
| 13 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
| 14 | public static partial class TimestampReflection { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 15 | |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 16 | #region Descriptor |
| 17 | /// <summary>File descriptor for google/protobuf/timestamp.proto</summary> |
| 18 | public static pbr::FileDescriptor Descriptor { |
| 19 | get { return descriptor; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 20 | } |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 21 | private static pbr::FileDescriptor descriptor; |
| 22 | |
| 23 | static TimestampReflection() { |
| 24 | byte[] descriptorData = global::System.Convert.FromBase64String( |
| 25 | string.Concat( |
| 26 | "Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJv", |
| 27 | "dG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MY", |
Jon Skeet | c588ac4 | 2016-04-20 17:19:42 +0100 | [diff] [blame] | 28 | "AiABKAVCgQEKE2NvbS5nb29nbGUucHJvdG9idWZCDlRpbWVzdGFtcFByb3Rv", |
| 29 | "UAFaK2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy90aW1lc3Rh", |
| 30 | "bXCgAQH4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlw", |
| 31 | "ZXNiBnByb3RvMw==")); |
Jon Skeet | a2667aa | 2015-11-19 17:14:23 +0000 | [diff] [blame] | 32 | descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 33 | new pbr::FileDescriptor[] { }, |
Jon Skeet | b615996 | 2016-02-04 07:08:55 +0000 | [diff] [blame] | 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) |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 36 | })); |
| 37 | } |
| 38 | #endregion |
| 39 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 40 | } |
| 41 | #region Messages |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 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). |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 54 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 55 | /// Example 1: Compute Timestamp from POSIX `time()`. |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 56 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 57 | /// Timestamp timestamp; |
| 58 | /// timestamp.set_seconds(time(NULL)); |
| 59 | /// timestamp.set_nanos(0); |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 60 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 61 | /// Example 2: Compute Timestamp from POSIX `gettimeofday()`. |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 62 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 63 | /// struct timeval tv; |
| 64 | /// gettimeofday(&tv, NULL); |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 65 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 66 | /// Timestamp timestamp; |
| 67 | /// timestamp.set_seconds(tv.tv_sec); |
| 68 | /// timestamp.set_nanos(tv.tv_usec * 1000); |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 69 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 70 | /// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 71 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 72 | /// FILETIME ft; |
| 73 | /// GetSystemTimeAsFileTime(&ft); |
| 74 | /// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 75 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 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)); |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 81 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 82 | /// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 83 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 84 | /// long millis = System.currentTimeMillis(); |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 85 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 86 | /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) |
| 87 | /// .setNanos((int) ((millis % 1000) * 1000000)).build(); |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 88 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 89 | /// Example 5: Compute Timestamp from current time in Python. |
Jon Skeet | cff900e | 2015-11-06 18:38:31 +0000 | [diff] [blame] | 90 | /// |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 91 | /// now = time.time() |
| 92 | /// seconds = int(now) |
| 93 | /// nanos = int((now - seconds) * 10**9) |
| 94 | /// timestamp = Timestamp(seconds=seconds, nanos=nanos) |
| 95 | /// </summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 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 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 101 | public static pbr::MessageDescriptor Descriptor { |
Jon Skeet | 284bb45 | 2015-11-05 09:13:53 +0000 | [diff] [blame] | 102 | get { return global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor.MessageTypes[0]; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 103 | } |
| 104 | |
Jon Skeet | 96cffaa | 2015-07-20 19:25:07 +0100 | [diff] [blame] | 105 | pbr::MessageDescriptor pb::IMessage.Descriptor { |
| 106 | get { return Descriptor; } |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 107 | } |
| 108 | |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 109 | public Timestamp() { |
| 110 | OnConstruction(); |
| 111 | } |
| 112 | |
| 113 | partial void OnConstruction(); |
| 114 | |
| 115 | public Timestamp(Timestamp other) : this() { |
| 116 | seconds_ = other.seconds_; |
| 117 | nanos_ = other.nanos_; |
| 118 | } |
| 119 | |
| 120 | public Timestamp Clone() { |
| 121 | return new Timestamp(this); |
| 122 | } |
| 123 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 124 | /// <summary>Field number for the "seconds" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 125 | public const int SecondsFieldNumber = 1; |
| 126 | private long seconds_; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 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> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 132 | public long Seconds { |
| 133 | get { return seconds_; } |
| 134 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 135 | seconds_ = value; |
| 136 | } |
| 137 | } |
| 138 | |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 139 | /// <summary>Field number for the "nanos" field.</summary> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 140 | public const int NanosFieldNumber = 2; |
| 141 | private int nanos_; |
Jon Skeet | 18e0a2e | 2015-10-01 10:38:01 +0100 | [diff] [blame] | 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> |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 148 | public int Nanos { |
| 149 | get { return nanos_; } |
| 150 | set { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 151 | nanos_ = value; |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | public override bool Equals(object other) { |
| 156 | return Equals(other as Timestamp); |
| 157 | } |
| 158 | |
| 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 | |
| 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 | |
| 178 | public override string ToString() { |
Jon Skeet | adee6fe | 2015-12-15 09:24:04 +0000 | [diff] [blame] | 179 | return pb::JsonFormatter.ToDiagnosticString(this); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 180 | } |
| 181 | |
| 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 | 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 | |
| 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 | |
| 216 | public void MergeFrom(pb::CodedInputStream input) { |
| 217 | uint tag; |
Jon Skeet | 1a57ad8 | 2015-08-05 11:23:52 +0100 | [diff] [blame] | 218 | while ((tag = input.ReadTag()) != 0) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 219 | switch(tag) { |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 220 | default: |
Jon Skeet | 5bdc572 | 2015-08-06 11:40:43 +0100 | [diff] [blame] | 221 | input.SkipLastField(); |
Jon Skeet | 62a4aa5 | 2015-07-14 14:26:49 +0100 | [diff] [blame] | 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 |