blob: 1044a6832223e7ffdee036fce86f0ab8d5f8eb62 [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
12 namespace Proto {
13
Jon Skeetb0888a42015-09-29 13:37:30 +010014 /// <summary>Holder for reflection information generated from google/protobuf/timestamp.proto</summary>
Jon Skeete2c82302015-09-29 14:34:31 +010015 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
Jon Skeet62a4aa52015-07-14 14:26:49 +010016 public static partial class Timestamp {
17
Jon Skeet62a4aa52015-07-14 14:26:49 +010018 #region Descriptor
Jon Skeetb0888a42015-09-29 13:37:30 +010019 /// <summary>File descriptor for google/protobuf/timestamp.proto</summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +010020 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 Skeet94898172015-09-01 15:47:48 +010028 "Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJv",
29 "dG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MY",
30 "AiABKAVCUQoTY29tLmdvb2dsZS5wcm90b2J1ZkIOVGltZXN0YW1wUHJvdG9Q",
31 "AaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG",
Jon Skeet47bf49b2015-07-22 11:39:38 +010032 "cHJvdG8z"));
Jon Skeet62a4aa52015-07-14 14:26:49 +010033 descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
Jon Skeet96cffaa2015-07-20 19:25:07 +010034 new pbr::FileDescriptor[] { },
Jon Skeet47bf49b2015-07-22 11:39:38 +010035 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 Skeet62a4aa52015-07-14 14:26:49 +010038 }
39 #endregion
40
41 }
42 }
43 #region Messages
Jon Skeet18e0a2e2015-10-01 10:38:01 +010044 /// <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 Skeetcff900e2015-11-06 18:38:31 +000056 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010057 /// Example 1: Compute Timestamp from POSIX `time()`.
Jon Skeetcff900e2015-11-06 18:38:31 +000058 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010059 /// Timestamp timestamp;
60 /// timestamp.set_seconds(time(NULL));
61 /// timestamp.set_nanos(0);
Jon Skeetcff900e2015-11-06 18:38:31 +000062 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010063 /// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
Jon Skeetcff900e2015-11-06 18:38:31 +000064 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010065 /// struct timeval tv;
66 /// gettimeofday(&amp;tv, NULL);
Jon Skeetcff900e2015-11-06 18:38:31 +000067 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010068 /// Timestamp timestamp;
69 /// timestamp.set_seconds(tv.tv_sec);
70 /// timestamp.set_nanos(tv.tv_usec * 1000);
Jon Skeetcff900e2015-11-06 18:38:31 +000071 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010072 /// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
Jon Skeetcff900e2015-11-06 18:38:31 +000073 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010074 /// FILETIME ft;
75 /// GetSystemTimeAsFileTime(&amp;ft);
76 /// UINT64 ticks = (((UINT64)ft.dwHighDateTime) &lt;&lt; 32) | ft.dwLowDateTime;
Jon Skeetcff900e2015-11-06 18:38:31 +000077 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010078 /// // 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 Skeetcff900e2015-11-06 18:38:31 +000083 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010084 /// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
Jon Skeetcff900e2015-11-06 18:38:31 +000085 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010086 /// long millis = System.currentTimeMillis();
Jon Skeetcff900e2015-11-06 18:38:31 +000087 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010088 /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
89 /// .setNanos((int) ((millis % 1000) * 1000000)).build();
Jon Skeetcff900e2015-11-06 18:38:31 +000090 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010091 /// Example 5: Compute Timestamp from current time in Python.
Jon Skeetcff900e2015-11-06 18:38:31 +000092 ///
Jon Skeet18e0a2e2015-10-01 10:38:01 +010093 /// now = time.time()
94 /// seconds = int(now)
95 /// nanos = int((now - seconds) * 10**9)
96 /// timestamp = Timestamp(seconds=seconds, nanos=nanos)
97 /// </summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +010098 [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 Skeet62a4aa52015-07-14 14:26:49 +0100103 public static pbr::MessageDescriptor Descriptor {
104 get { return global::Google.Protobuf.WellKnownTypes.Proto.Timestamp.Descriptor.MessageTypes[0]; }
105 }
106
Jon Skeet96cffaa2015-07-20 19:25:07 +0100107 pbr::MessageDescriptor pb::IMessage.Descriptor {
108 get { return Descriptor; }
Jon Skeet62a4aa52015-07-14 14:26:49 +0100109 }
110
Jon Skeet62a4aa52015-07-14 14:26:49 +0100111 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 Skeet18e0a2e2015-10-01 10:38:01 +0100126 /// <summary>Field number for the "seconds" field.</summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +0100127 public const int SecondsFieldNumber = 1;
128 private long seconds_;
Jon Skeet18e0a2e2015-10-01 10:38:01 +0100129 /// <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 Skeet62a4aa52015-07-14 14:26:49 +0100134 public long Seconds {
135 get { return seconds_; }
136 set {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100137 seconds_ = value;
138 }
139 }
140
Jon Skeet18e0a2e2015-10-01 10:38:01 +0100141 /// <summary>Field number for the "nanos" field.</summary>
Jon Skeet62a4aa52015-07-14 14:26:49 +0100142 public const int NanosFieldNumber = 2;
143 private int nanos_;
Jon Skeet18e0a2e2015-10-01 10:38:01 +0100144 /// <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 Skeet62a4aa52015-07-14 14:26:49 +0100150 public int Nanos {
151 get { return nanos_; }
152 set {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100153 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 Skeet1a57ad82015-08-05 11:23:52 +0100220 while ((tag = input.ReadTag()) != 0) {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100221 switch(tag) {
Jon Skeet62a4aa52015-07-14 14:26:49 +0100222 default:
Jon Skeet5bdc5722015-08-06 11:40:43 +0100223 input.SkipLastField();
Jon Skeet62a4aa52015-07-14 14:26:49 +0100224 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