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