1 // Code generated by protoc-gen-go. DO NOT EDIT. 2 // source: github.com/golang/protobuf/ptypes/timestamp/timestamp.proto 3 4 /* 5 Package timestamp is a generated protocol buffer package. 6 7 It is generated from these files: 8 github.com/golang/protobuf/ptypes/timestamp/timestamp.proto 9 10 It has these top-level messages: 11 Timestamp 12 */ 13 package timestamp 14 15 import proto "github.com/golang/protobuf/proto" 16 import fmt "fmt" 17 import math "math" 18 19 // Reference imports to suppress errors if they are not otherwise used. 20 var _ = proto.Marshal 21 var _ = fmt.Errorf 22 var _ = math.Inf 23 24 // This is a compile-time assertion to ensure that this generated file 25 // is compatible with the proto package it is being compiled against. 26 // A compilation error at this line likely means your copy of the 27 // proto package needs to be updated. 28 const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package 29 30 // A Timestamp represents a point in time independent of any time zone 31 // or calendar, represented as seconds and fractions of seconds at 32 // nanosecond resolution in UTC Epoch time. It is encoded using the 33 // Proleptic Gregorian Calendar which extends the Gregorian calendar 34 // backwards to year one. It is encoded assuming all minutes are 60 35 // seconds long, i.e. leap seconds are "smeared" so that no leap second 36 // table is needed for interpretation. Range is from 37 // 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. 38 // By restricting to that range, we ensure that we can convert to 39 // and from RFC 3339 date strings. 40 // See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). 41 // 42 // # Examples 43 // 44 // Example 1: Compute Timestamp from POSIX `time()`. 45 // 46 // Timestamp timestamp; 47 // timestamp.set_seconds(time(NULL)); 48 // timestamp.set_nanos(0); 49 // 50 // Example 2: Compute Timestamp from POSIX `gettimeofday()`. 51 // 52 // struct timeval tv; 53 // gettimeofday(&tv, NULL); 54 // 55 // Timestamp timestamp; 56 // timestamp.set_seconds(tv.tv_sec); 57 // timestamp.set_nanos(tv.tv_usec * 1000); 58 // 59 // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. 60 // 61 // FILETIME ft; 62 // GetSystemTimeAsFileTime(&ft); 63 // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; 64 // 65 // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z 66 // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. 67 // Timestamp timestamp; 68 // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); 69 // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); 70 // 71 // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. 72 // 73 // long millis = System.currentTimeMillis(); 74 // 75 // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) 76 // .setNanos((int) ((millis % 1000) * 1000000)).build(); 77 // 78 // 79 // Example 5: Compute Timestamp from current time in Python. 80 // 81 // timestamp = Timestamp() 82 // timestamp.GetCurrentTime() 83 // 84 // # JSON Mapping 85 // 86 // In JSON format, the Timestamp type is encoded as a string in the 87 // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the 88 // format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" 89 // where {year} is always expressed using four digits while {month}, {day}, 90 // {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional 91 // seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), 92 // are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone 93 // is required, though only UTC (as indicated by "Z") is presently supported. 94 // 95 // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 96 // 01:30 UTC on January 15, 2017. 97 // 98 // In JavaScript, one can convert a Date object to this format using the 99 // standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString] 100 // method. In Python, a standard `datetime.datetime` object can be converted 101 // to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) 102 // with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one 103 // can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( 104 // http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()) 105 // to obtain a formatter capable of generating timestamps in this format. 106 // 107 // 108 type Timestamp struct { 109 // Represents seconds of UTC time since Unix epoch 110 // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 111 // 9999-12-31T23:59:59Z inclusive. 112 Seconds int64 `protobuf:"varint,1,opt,name=seconds" json:"seconds,omitempty"` 113 // Non-negative fractions of a second at nanosecond resolution. Negative 114 // second values with fractions must still have non-negative nanos values 115 // that count forward in time. Must be from 0 to 999,999,999 116 // inclusive. 117 Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"` 118 } 119 120 func (m *Timestamp) Reset() { *m = Timestamp{} } 121 func (m *Timestamp) String() string { return proto.CompactTextString(m) } 122 func (*Timestamp) ProtoMessage() {} 123 func (*Timestamp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } 124 func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" } 125 126 func (m *Timestamp) GetSeconds() int64 { 127 if m != nil { 128 return m.Seconds 129 } 130 return 0 131 } 132 133 func (m *Timestamp) GetNanos() int32 { 134 if m != nil { 135 return m.Nanos 136 } 137 return 0 138 } 139 140 func init() { 141 proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp") 142 } 143 144 func init() { 145 proto.RegisterFile("github.com/golang/protobuf/ptypes/timestamp/timestamp.proto", fileDescriptor0) 146 } 147 148 var fileDescriptor0 = []byte{ 149 // 190 bytes of a gzipped FileDescriptorProto 150 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x4e, 0xcf, 0x2c, 0xc9, 151 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x2f, 0x28, 152 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0x28, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2f, 0xc9, 153 0xcc, 0x4d, 0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0x40, 0xb0, 0xf4, 0xc0, 0x6a, 0x84, 0xf8, 0xd3, 0xf3, 154 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x60, 0x3a, 0x94, 0xac, 0xb9, 0x38, 0x43, 0x60, 0x6a, 0x84, 0x24, 155 0xb8, 0xd8, 0x8b, 0x53, 0x93, 0xf3, 0xf3, 0x52, 0x8a, 0x25, 0x18, 0x15, 0x18, 0x35, 0x98, 0x83, 156 0x60, 0x5c, 0x21, 0x11, 0x2e, 0xd6, 0xbc, 0xc4, 0xbc, 0xfc, 0x62, 0x09, 0x26, 0x05, 0x46, 0x0d, 157 0xd6, 0x20, 0x08, 0xc7, 0xa9, 0x8e, 0x4b, 0x38, 0x39, 0x3f, 0x57, 0x0f, 0xcd, 0x4c, 0x27, 0x3e, 158 0xb8, 0x89, 0x01, 0x20, 0xa1, 0x00, 0xc6, 0x28, 0x6d, 0x12, 0xdc, 0xfc, 0x83, 0x91, 0x71, 0x11, 159 0x13, 0xb3, 0x7b, 0x80, 0xd3, 0x2a, 0x26, 0x39, 0x77, 0x88, 0xc9, 0x01, 0x50, 0xb5, 0x7a, 0xe1, 160 0xa9, 0x39, 0x39, 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x20, 0x3d, 0x49, 0x6c, 0x60, 0x43, 0x8c, 161 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x59, 0x0a, 0x4d, 0x13, 0x01, 0x00, 0x00, 162 } 163