blob: 6fe6d42f17ac777991502677692d86a0512ec661 [file] [log] [blame]
Andrea Campanella3614a922021-02-25 12:40:42 +01001// Protocol Buffers - Google's data interchange format
2// Copyright 2008 Google Inc. All rights reserved.
3// https://developers.google.com/protocol-buffers/
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are
7// met:
8//
9// * Redistributions of source code must retain the above copyright
10// notice, this list of conditions and the following disclaimer.
11// * Redistributions in binary form must reproduce the above
12// copyright notice, this list of conditions and the following disclaimer
13// in the documentation and/or other materials provided with the
14// distribution.
15// * Neither the name of Google Inc. nor the names of its
16// contributors may be used to endorse or promote products derived from
17// this software without specific prior written permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31// Code generated by protoc-gen-go. DO NOT EDIT.
32// source: google/protobuf/timestamp.proto
33
34package timestamppb
35
36import (
37 protoreflect "google.golang.org/protobuf/reflect/protoreflect"
38 protoimpl "google.golang.org/protobuf/runtime/protoimpl"
39 reflect "reflect"
40 sync "sync"
41)
42
43// A Timestamp represents a point in time independent of any time zone or local
44// calendar, encoded as a count of seconds and fractions of seconds at
45// nanosecond resolution. The count is relative to an epoch at UTC midnight on
46// January 1, 1970, in the proleptic Gregorian calendar which extends the
47// Gregorian calendar backwards to year one.
48//
49// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
50// second table is needed for interpretation, using a [24-hour linear
51// smear](https://developers.google.com/time/smear).
52//
53// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
54// restricting to that range, we ensure that we can convert to and from [RFC
55// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
56//
57// # Examples
58//
59// Example 1: Compute Timestamp from POSIX `time()`.
60//
61// Timestamp timestamp;
62// timestamp.set_seconds(time(NULL));
63// timestamp.set_nanos(0);
64//
65// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
66//
67// struct timeval tv;
68// gettimeofday(&tv, NULL);
69//
70// Timestamp timestamp;
71// timestamp.set_seconds(tv.tv_sec);
72// timestamp.set_nanos(tv.tv_usec * 1000);
73//
74// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
75//
76// FILETIME ft;
77// GetSystemTimeAsFileTime(&ft);
78// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
79//
80// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
81// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
82// Timestamp timestamp;
83// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
84// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
85//
86// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
87//
88// long millis = System.currentTimeMillis();
89//
90// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
91// .setNanos((int) ((millis % 1000) * 1000000)).build();
92//
93//
94// Example 5: Compute Timestamp from current time in Python.
95//
96// timestamp = Timestamp()
97// timestamp.GetCurrentTime()
98//
99// # JSON Mapping
100//
101// In JSON format, the Timestamp type is encoded as a string in the
102// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
103// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
104// where {year} is always expressed using four digits while {month}, {day},
105// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
106// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
107// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
108// is required. A proto3 JSON serializer should always use UTC (as indicated by
109// "Z") when printing the Timestamp type and a proto3 JSON parser should be
110// able to accept both UTC and other timezones (as indicated by an offset).
111//
112// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
113// 01:30 UTC on January 15, 2017.
114//
115// In JavaScript, one can convert a Date object to this format using the
116// standard
117// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
118// method. In Python, a standard `datetime.datetime` object can be converted
119// to this format using
120// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
121// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
122// the Joda Time's [`ISODateTimeFormat.dateTime()`](
123// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
124// ) to obtain a formatter capable of generating timestamps in this format.
125//
126//
127type Timestamp struct {
128 state protoimpl.MessageState
129 sizeCache protoimpl.SizeCache
130 unknownFields protoimpl.UnknownFields
131
132 // Represents seconds of UTC time since Unix epoch
133 // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
134 // 9999-12-31T23:59:59Z inclusive.
135 Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
136 // Non-negative fractions of a second at nanosecond resolution. Negative
137 // second values with fractions must still have non-negative nanos values
138 // that count forward in time. Must be from 0 to 999,999,999
139 // inclusive.
140 Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
141}
142
143func (x *Timestamp) Reset() {
144 *x = Timestamp{}
145 if protoimpl.UnsafeEnabled {
146 mi := &file_google_protobuf_timestamp_proto_msgTypes[0]
147 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
148 ms.StoreMessageInfo(mi)
149 }
150}
151
152func (x *Timestamp) String() string {
153 return protoimpl.X.MessageStringOf(x)
154}
155
156func (*Timestamp) ProtoMessage() {}
157
158func (x *Timestamp) ProtoReflect() protoreflect.Message {
159 mi := &file_google_protobuf_timestamp_proto_msgTypes[0]
160 if protoimpl.UnsafeEnabled && x != nil {
161 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
162 if ms.LoadMessageInfo() == nil {
163 ms.StoreMessageInfo(mi)
164 }
165 return ms
166 }
167 return mi.MessageOf(x)
168}
169
170// Deprecated: Use Timestamp.ProtoReflect.Descriptor instead.
171func (*Timestamp) Descriptor() ([]byte, []int) {
172 return file_google_protobuf_timestamp_proto_rawDescGZIP(), []int{0}
173}
174
175func (x *Timestamp) GetSeconds() int64 {
176 if x != nil {
177 return x.Seconds
178 }
179 return 0
180}
181
182func (x *Timestamp) GetNanos() int32 {
183 if x != nil {
184 return x.Nanos
185 }
186 return 0
187}
188
189var File_google_protobuf_timestamp_proto protoreflect.FileDescriptor
190
191var file_google_protobuf_timestamp_proto_rawDesc = []byte{
192 0x0a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
193 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74,
194 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
195 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12,
196 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
197 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e,
198 0x6f, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42,
199 0x7e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
200 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
201 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
202 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74,
203 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65,
204 0x73, 0x74, 0x61, 0x6d, 0x70, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02,
205 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
206 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62,
207 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
208}
209
210var (
211 file_google_protobuf_timestamp_proto_rawDescOnce sync.Once
212 file_google_protobuf_timestamp_proto_rawDescData = file_google_protobuf_timestamp_proto_rawDesc
213)
214
215func file_google_protobuf_timestamp_proto_rawDescGZIP() []byte {
216 file_google_protobuf_timestamp_proto_rawDescOnce.Do(func() {
217 file_google_protobuf_timestamp_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_timestamp_proto_rawDescData)
218 })
219 return file_google_protobuf_timestamp_proto_rawDescData
220}
221
222var file_google_protobuf_timestamp_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
223var file_google_protobuf_timestamp_proto_goTypes = []interface{}{
224 (*Timestamp)(nil), // 0: google.protobuf.Timestamp
225}
226var file_google_protobuf_timestamp_proto_depIdxs = []int32{
227 0, // [0:0] is the sub-list for method output_type
228 0, // [0:0] is the sub-list for method input_type
229 0, // [0:0] is the sub-list for extension type_name
230 0, // [0:0] is the sub-list for extension extendee
231 0, // [0:0] is the sub-list for field type_name
232}
233
234func init() { file_google_protobuf_timestamp_proto_init() }
235func file_google_protobuf_timestamp_proto_init() {
236 if File_google_protobuf_timestamp_proto != nil {
237 return
238 }
239 if !protoimpl.UnsafeEnabled {
240 file_google_protobuf_timestamp_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
241 switch v := v.(*Timestamp); i {
242 case 0:
243 return &v.state
244 case 1:
245 return &v.sizeCache
246 case 2:
247 return &v.unknownFields
248 default:
249 return nil
250 }
251 }
252 }
253 type x struct{}
254 out := protoimpl.TypeBuilder{
255 File: protoimpl.DescBuilder{
256 GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
257 RawDescriptor: file_google_protobuf_timestamp_proto_rawDesc,
258 NumEnums: 0,
259 NumMessages: 1,
260 NumExtensions: 0,
261 NumServices: 0,
262 },
263 GoTypes: file_google_protobuf_timestamp_proto_goTypes,
264 DependencyIndexes: file_google_protobuf_timestamp_proto_depIdxs,
265 MessageInfos: file_google_protobuf_timestamp_proto_msgTypes,
266 }.Build()
267 File_google_protobuf_timestamp_proto = out.File
268 file_google_protobuf_timestamp_proto_rawDesc = nil
269 file_google_protobuf_timestamp_proto_goTypes = nil
270 file_google_protobuf_timestamp_proto_depIdxs = nil
271}