1// Code generated by protoc-gen-go. DO NOT EDIT. 2// source: google/protobuf/timestamp.proto 3 4package timestamp 5 6import ( 7 fmt "fmt" 8 proto "github.com/golang/protobuf/proto" 9 math "math" 10) 11 12// Reference imports to suppress errors if they are not otherwise used. 13var _ = proto.Marshal 14var _ = fmt.Errorf 15var _ = math.Inf 16 17// This is a compile-time assertion to ensure that this generated file 18// is compatible with the proto package it is being compiled against. 19// A compilation error at this line likely means your copy of the 20// proto package needs to be updated. 21const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 22 23// A Timestamp represents a point in time independent of any time zone or local 24// calendar, encoded as a count of seconds and fractions of seconds at 25// nanosecond resolution. The count is relative to an epoch at UTC midnight on 26// January 1, 1970, in the proleptic Gregorian calendar which extends the 27// Gregorian calendar backwards to year one. 28// 29// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap 30// second table is needed for interpretation, using a [24-hour linear 31// smear](https://developers.google.com/time/smear). 32// 33// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By 34// restricting to that range, we ensure that we can convert to and from [RFC 35// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. 36// 37// # Examples 38// 39// Example 1: Compute Timestamp from POSIX `time()`. 40// 41// Timestamp timestamp; 42// timestamp.set_seconds(time(NULL)); 43// timestamp.set_nanos(0); 44// 45// Example 2: Compute Timestamp from POSIX `gettimeofday()`. 46// 47// struct timeval tv; 48// gettimeofday(&tv, NULL); 49// 50// Timestamp timestamp; 51// timestamp.set_seconds(tv.tv_sec); 52// timestamp.set_nanos(tv.tv_usec * 1000); 53// 54// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. 55// 56// FILETIME ft; 57// GetSystemTimeAsFileTime(&ft); 58// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; 59// 60// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z 61// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. 62// Timestamp timestamp; 63// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); 64// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); 65// 66// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. 67// 68// long millis = System.currentTimeMillis(); 69// 70// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) 71// .setNanos((int) ((millis % 1000) * 1000000)).build(); 72// 73// 74// Example 5: Compute Timestamp from current time in Python. 75// 76// timestamp = Timestamp() 77// timestamp.GetCurrentTime() 78// 79// # JSON Mapping 80// 81// In JSON format, the Timestamp type is encoded as a string in the 82// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the 83// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" 84// where {year} is always expressed using four digits while {month}, {day}, 85// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional 86// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), 87// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone 88// is required. A proto3 JSON serializer should always use UTC (as indicated by 89// "Z") when printing the Timestamp type and a proto3 JSON parser should be 90// able to accept both UTC and other timezones (as indicated by an offset). 91// 92// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 93// 01:30 UTC on January 15, 2017. 94// 95// In JavaScript, one can convert a Date object to this format using the 96// standard 97// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) 98// method. In Python, a standard `datetime.datetime` object can be converted 99// to this format using 100// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with 101// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use 102// the Joda Time's [`ISODateTimeFormat.dateTime()`]( 103// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D 104// ) to obtain a formatter capable of generating timestamps in this format. 105// 106// 107type Timestamp struct { 108 // Represents seconds of UTC time since Unix epoch 109 // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 110 // 9999-12-31T23:59:59Z inclusive. 111 Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` 112 // Non-negative fractions of a second at nanosecond resolution. Negative 113 // second values with fractions must still have non-negative nanos values 114 // that count forward in time. Must be from 0 to 999,999,999 115 // inclusive. 116 Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` 117 XXX_NoUnkeyedLiteral struct{} `json:"-"` 118 XXX_unrecognized []byte `json:"-"` 119 XXX_sizecache int32 `json:"-"` 120} 121 122func (m *Timestamp) Reset() { *m = Timestamp{} } 123func (m *Timestamp) String() string { return proto.CompactTextString(m) } 124func (*Timestamp) ProtoMessage() {} 125func (*Timestamp) Descriptor() ([]byte, []int) { 126 return fileDescriptor_292007bbfe81227e, []int{0} 127} 128 129func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" } 130 131func (m *Timestamp) XXX_Unmarshal(b []byte) error { 132 return xxx_messageInfo_Timestamp.Unmarshal(m, b) 133} 134func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 135 return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic) 136} 137func (m *Timestamp) XXX_Merge(src proto.Message) { 138 xxx_messageInfo_Timestamp.Merge(m, src) 139} 140func (m *Timestamp) XXX_Size() int { 141 return xxx_messageInfo_Timestamp.Size(m) 142} 143func (m *Timestamp) XXX_DiscardUnknown() { 144 xxx_messageInfo_Timestamp.DiscardUnknown(m) 145} 146 147var xxx_messageInfo_Timestamp proto.InternalMessageInfo 148 149func (m *Timestamp) GetSeconds() int64 { 150 if m != nil { 151 return m.Seconds 152 } 153 return 0 154} 155 156func (m *Timestamp) GetNanos() int32 { 157 if m != nil { 158 return m.Nanos 159 } 160 return 0 161} 162 163func init() { 164 proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp") 165} 166 167func init() { 168 proto.RegisterFile("google/protobuf/timestamp.proto", fileDescriptor_292007bbfe81227e) 169} 170 171var fileDescriptor_292007bbfe81227e = []byte{ 172 // 191 bytes of a gzipped FileDescriptorProto 173 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xcf, 0xcf, 0x4f, 174 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xc9, 0xcc, 0x4d, 175 0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0xd0, 0x03, 0x0b, 0x09, 0xf1, 0x43, 0x14, 0xe8, 0xc1, 0x14, 0x28, 176 0x59, 0x73, 0x71, 0x86, 0xc0, 0xd4, 0x08, 0x49, 0x70, 0xb1, 0x17, 0xa7, 0x26, 0xe7, 0xe7, 0xa5, 177 0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0xc1, 0xb8, 0x42, 0x22, 0x5c, 0xac, 0x79, 0x89, 178 0x79, 0xf9, 0xc5, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xac, 0x41, 0x10, 0x8e, 0x53, 0x1d, 0x97, 0x70, 179 0x72, 0x7e, 0xae, 0x1e, 0x9a, 0x99, 0x4e, 0x7c, 0x70, 0x13, 0x03, 0x40, 0x42, 0x01, 0x8c, 0x51, 180 0xda, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0x39, 0x89, 181 0x79, 0xe9, 0x08, 0x27, 0x16, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x23, 0x5c, 0xfa, 0x83, 0x91, 0x71, 182 0x11, 0x13, 0xb3, 0x7b, 0x80, 0xd3, 0x2a, 0x26, 0x39, 0x77, 0x88, 0xc9, 0x01, 0x50, 0xb5, 0x7a, 183 0xe1, 0xa9, 0x39, 0x39, 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x20, 0x3d, 0x49, 0x6c, 0x60, 0x43, 184 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x77, 0x4a, 0x07, 0xf7, 0x00, 0x00, 0x00, 185} 186