blob: 053b88bd33c9e639a12da4a13a361f1975292906 [file] [log] [blame]
Jon Skeet62a4aa52015-07-14 14:26:49 +01001// 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
6using pb = global::Google.Protobuf;
7using pbc = global::Google.Protobuf.Collections;
8using pbr = global::Google.Protobuf.Reflection;
9using scg = global::System.Collections.Generic;
10namespace Google.Protobuf.WellKnownTypes {
11
Jon Skeet284bb452015-11-05 09:13:53 +000012 /// <summary>Holder for reflection information generated from google/protobuf/timestamp.proto</summary>
13 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
14 public static partial class TimestampReflection {
Jon Skeet62a4aa52015-07-14 14:26:49 +010015
Jon Skeet284bb452015-11-05 09:13:53 +000016 #region Descriptor
17 /// <summary>File descriptor for google/protobuf/timestamp.proto</summary>
18 public static pbr::FileDescriptor Descriptor {
19 get { return descriptor; }
Jon Skeet62a4aa52015-07-14 14:26:49 +010020 }
Jon Skeet284bb452015-11-05 09:13:53 +000021 private static pbr::FileDescriptor descriptor;
22
23 static TimestampReflection() {
24 byte[] descriptorData = global::System.Convert.FromBase64String(
25 string.Concat(
26 "Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJv",
27 "dG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MY",
Jon Skeetc588ac42016-04-20 17:19:42 +010028 "AiABKAVCgQEKE2NvbS5nb29nbGUucHJvdG9idWZCDlRpbWVzdGFtcFByb3Rv",
29 "UAFaK2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy90aW1lc3Rh",
30 "bXCgAQH4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlw",
31 "ZXNiBnByb3RvMw=="));
Jon Skeeta2667aa2015-11-19 17:14:23 +000032 descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
Jon Skeet284bb452015-11-05 09:13:53 +000033 new pbr::FileDescriptor[] { },
Jon Skeetb6159962016-02-04 07:08:55 +000034 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 Skeet284bb452015-11-05 09:13:53 +000036 }));
37 }
38 #endregion
39
Jon Skeet62a4aa52015-07-14 14:26:49 +010040 }
41 #region Messages
Jon Skeet18e0a2e2015-10-01 10:38:01 +010042 /// <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 Skeetcff900e2015-11-06 18:38:31 +000054 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010055 /// Example 1: Compute Timestamp from POSIX `time()`.
Jon Skeetcff900e2015-11-06 18:38:31 +000056 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010057 /// Timestamp timestamp;
58 /// timestamp.set_seconds(time(NULL));
59 /// timestamp.set_nanos(0);
Jon Skeetcff900e2015-11-06 18:38:31 +000060 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010061 /// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
Jon Skeetcff900e2015-11-06 18:38:31 +000062 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010063 /// struct timeval tv;
64 /// gettimeofday(&amp;tv, NULL);
Jon Skeetcff900e2015-11-06 18:38:31 +000065 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010066 /// Timestamp timestamp;
67 /// timestamp.set_seconds(tv.tv_sec);
68 /// timestamp.set_nanos(tv.tv_usec * 1000);
Jon Skeetcff900e2015-11-06 18:38:31 +000069 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010070 /// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
Jon Skeetcff900e2015-11-06 18:38:31 +000071 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010072 /// FILETIME ft;
73 /// GetSystemTimeAsFileTime(&amp;ft);
74 /// UINT64 ticks = (((UINT64)ft.dwHighDateTime) &lt;&lt; 32) | ft.dwLowDateTime;
Jon Skeetcff900e2015-11-06 18:38:31 +000075 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010076 /// // 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 Skeetcff900e2015-11-06 18:38:31 +000081 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010082 /// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
Jon Skeetcff900e2015-11-06 18:38:31 +000083 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010084 /// long millis = System.currentTimeMillis();
Jon Skeetcff900e2015-11-06 18:38:31 +000085 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010086 /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
87 /// .setNanos((int) ((millis % 1000) * 1000000)).build();
Jon Skeetcff900e2015-11-06 18:38:31 +000088 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010089 /// Example 5: Compute Timestamp from current time in Python.
Jon Skeetcff900e2015-11-06 18:38:31 +000090 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010091 /// now = time.time()
92 /// seconds = int(now)
93 /// nanos = int((now - seconds) * 10**9)
94 /// timestamp = Timestamp(seconds=seconds, nanos=nanos)
95 /// </summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +010096 [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 Skeet62a4aa52015-07-14 14:26:49 +0100101 public static pbr::MessageDescriptor Descriptor {
Jon Skeet284bb452015-11-05 09:13:53 +0000102 get { return global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor.MessageTypes[0]; }
Jon Skeet62a4aa52015-07-14 14:26:49 +0100103 }
104
Jon Skeet96cffaa2015-07-20 19:25:07 +0100105 pbr::MessageDescriptor pb::IMessage.Descriptor {
106 get { return Descriptor; }
Jon Skeet62a4aa52015-07-14 14:26:49 +0100107 }
108
Jon Skeet62a4aa52015-07-14 14:26:49 +0100109 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 Skeet18e0a2e2015-10-01 10:38:01 +0100124 /// <summary>Field number for the "seconds" field.</summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +0100125 public const int SecondsFieldNumber = 1;
126 private long seconds_;
Jon Skeet18e0a2e2015-10-01 10:38:01 +0100127 /// <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 Skeet62a4aa52015-07-14 14:26:49 +0100132 public long Seconds {
133 get { return seconds_; }
134 set {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100135 seconds_ = value;
136 }
137 }
138
Jon Skeet18e0a2e2015-10-01 10:38:01 +0100139 /// <summary>Field number for the "nanos" field.</summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +0100140 public const int NanosFieldNumber = 2;
141 private int nanos_;
Jon Skeet18e0a2e2015-10-01 10:38:01 +0100142 /// <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 Skeet62a4aa52015-07-14 14:26:49 +0100148 public int Nanos {
149 get { return nanos_; }
150 set {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100151 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 Skeetadee6fe2015-12-15 09:24:04 +0000179 return pb::JsonFormatter.ToDiagnosticString(this);
Jon Skeet62a4aa52015-07-14 14:26:49 +0100180 }
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 Skeet1a57ad82015-08-05 11:23:52 +0100218 while ((tag = input.ReadTag()) != 0) {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100219 switch(tag) {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100220 default:
Jon Skeet5bdc5722015-08-06 11:40:43 +0100221 input.SkipLastField();
Jon Skeet62a4aa52015-07-14 14:26:49 +0100222 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