| // Code generated by protoc-gen-gogo. DO NOT EDIT. |
| // source: google/protobuf/timestamp.proto |
| |
| package types |
| |
| import proto "github.com/gogo/protobuf/proto" |
| import fmt "fmt" |
| import math "math" |
| |
| import bytes "bytes" |
| |
| import strings "strings" |
| import reflect "reflect" |
| |
| import io "io" |
| |
| // Reference imports to suppress errors if they are not otherwise used. |
| var _ = proto.Marshal |
| var _ = fmt.Errorf |
| var _ = math.Inf |
| |
| // This is a compile-time assertion to ensure that this generated file |
| // is compatible with the proto package it is being compiled against. |
| // A compilation error at this line likely means your copy of the |
| // proto package needs to be updated. |
| const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package |
| |
| // A Timestamp represents a point in time independent of any time zone |
| // or calendar, represented as seconds and fractions of seconds at |
| // nanosecond resolution in UTC Epoch time. It is encoded using the |
| // Proleptic Gregorian Calendar which extends the Gregorian calendar |
| // backwards to year one. It is encoded assuming all minutes are 60 |
| // seconds long, i.e. leap seconds are "smeared" so that no leap second |
| // table is needed for interpretation. Range is from |
| // 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. |
| // By restricting to that range, we ensure that we can convert to |
| // and from RFC 3339 date strings. |
| // See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). |
| // |
| // # Examples |
| // |
| // Example 1: Compute Timestamp from POSIX `time()`. |
| // |
| // Timestamp timestamp; |
| // timestamp.set_seconds(time(NULL)); |
| // timestamp.set_nanos(0); |
| // |
| // Example 2: Compute Timestamp from POSIX `gettimeofday()`. |
| // |
| // struct timeval tv; |
| // gettimeofday(&tv, NULL); |
| // |
| // Timestamp timestamp; |
| // timestamp.set_seconds(tv.tv_sec); |
| // timestamp.set_nanos(tv.tv_usec * 1000); |
| // |
| // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. |
| // |
| // FILETIME ft; |
| // GetSystemTimeAsFileTime(&ft); |
| // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; |
| // |
| // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z |
| // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. |
| // Timestamp timestamp; |
| // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); |
| // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); |
| // |
| // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. |
| // |
| // long millis = System.currentTimeMillis(); |
| // |
| // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) |
| // .setNanos((int) ((millis % 1000) * 1000000)).build(); |
| // |
| // |
| // Example 5: Compute Timestamp from current time in Python. |
| // |
| // timestamp = Timestamp() |
| // timestamp.GetCurrentTime() |
| // |
| // # JSON Mapping |
| // |
| // In JSON format, the Timestamp type is encoded as a string in the |
| // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the |
| // format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" |
| // where {year} is always expressed using four digits while {month}, {day}, |
| // {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional |
| // seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), |
| // are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone |
| // is required. A proto3 JSON serializer should always use UTC (as indicated by |
| // "Z") when printing the Timestamp type and a proto3 JSON parser should be |
| // able to accept both UTC and other timezones (as indicated by an offset). |
| // |
| // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past |
| // 01:30 UTC on January 15, 2017. |
| // |
| // In JavaScript, one can convert a Date object to this format using the |
| // standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString] |
| // method. In Python, a standard `datetime.datetime` object can be converted |
| // to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) |
| // with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one |
| // can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( |
| // http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime-- |
| // ) to obtain a formatter capable of generating timestamps in this format. |
| // |
| // |
| type Timestamp struct { |
| // Represents seconds of UTC time since Unix epoch |
| // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to |
| // 9999-12-31T23:59:59Z inclusive. |
| Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` |
| // Non-negative fractions of a second at nanosecond resolution. Negative |
| // second values with fractions must still have non-negative nanos values |
| // that count forward in time. Must be from 0 to 999,999,999 |
| // inclusive. |
| Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` |
| XXX_NoUnkeyedLiteral struct{} `json:"-"` |
| XXX_unrecognized []byte `json:"-"` |
| XXX_sizecache int32 `json:"-"` |
| } |
| |
| func (m *Timestamp) Reset() { *m = Timestamp{} } |
| func (*Timestamp) ProtoMessage() {} |
| func (*Timestamp) Descriptor() ([]byte, []int) { |
| return fileDescriptor_timestamp_0a0a9bc758317e91, []int{0} |
| } |
| func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" } |
| func (m *Timestamp) XXX_Unmarshal(b []byte) error { |
| return m.Unmarshal(b) |
| } |
| func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
| if deterministic { |
| return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic) |
| } else { |
| b = b[:cap(b)] |
| n, err := m.MarshalTo(b) |
| if err != nil { |
| return nil, err |
| } |
| return b[:n], nil |
| } |
| } |
| func (dst *Timestamp) XXX_Merge(src proto.Message) { |
| xxx_messageInfo_Timestamp.Merge(dst, src) |
| } |
| func (m *Timestamp) XXX_Size() int { |
| return m.Size() |
| } |
| func (m *Timestamp) XXX_DiscardUnknown() { |
| xxx_messageInfo_Timestamp.DiscardUnknown(m) |
| } |
| |
| var xxx_messageInfo_Timestamp proto.InternalMessageInfo |
| |
| func (m *Timestamp) GetSeconds() int64 { |
| if m != nil { |
| return m.Seconds |
| } |
| return 0 |
| } |
| |
| func (m *Timestamp) GetNanos() int32 { |
| if m != nil { |
| return m.Nanos |
| } |
| return 0 |
| } |
| |
| func (*Timestamp) XXX_MessageName() string { |
| return "google.protobuf.Timestamp" |
| } |
| func init() { |
| proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp") |
| } |
| func (this *Timestamp) Compare(that interface{}) int { |
| if that == nil { |
| if this == nil { |
| return 0 |
| } |
| return 1 |
| } |
| |
| that1, ok := that.(*Timestamp) |
| if !ok { |
| that2, ok := that.(Timestamp) |
| if ok { |
| that1 = &that2 |
| } else { |
| return 1 |
| } |
| } |
| if that1 == nil { |
| if this == nil { |
| return 0 |
| } |
| return 1 |
| } else if this == nil { |
| return -1 |
| } |
| if this.Seconds != that1.Seconds { |
| if this.Seconds < that1.Seconds { |
| return -1 |
| } |
| return 1 |
| } |
| if this.Nanos != that1.Nanos { |
| if this.Nanos < that1.Nanos { |
| return -1 |
| } |
| return 1 |
| } |
| if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { |
| return c |
| } |
| return 0 |
| } |
| func (this *Timestamp) Equal(that interface{}) bool { |
| if that == nil { |
| return this == nil |
| } |
| |
| that1, ok := that.(*Timestamp) |
| if !ok { |
| that2, ok := that.(Timestamp) |
| if ok { |
| that1 = &that2 |
| } else { |
| return false |
| } |
| } |
| if that1 == nil { |
| return this == nil |
| } else if this == nil { |
| return false |
| } |
| if this.Seconds != that1.Seconds { |
| return false |
| } |
| if this.Nanos != that1.Nanos { |
| return false |
| } |
| if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { |
| return false |
| } |
| return true |
| } |
| func (this *Timestamp) GoString() string { |
| if this == nil { |
| return "nil" |
| } |
| s := make([]string, 0, 6) |
| s = append(s, "&types.Timestamp{") |
| s = append(s, "Seconds: "+fmt.Sprintf("%#v", this.Seconds)+",\n") |
| s = append(s, "Nanos: "+fmt.Sprintf("%#v", this.Nanos)+",\n") |
| if this.XXX_unrecognized != nil { |
| s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") |
| } |
| s = append(s, "}") |
| return strings.Join(s, "") |
| } |
| func valueToGoStringTimestamp(v interface{}, typ string) string { |
| rv := reflect.ValueOf(v) |
| if rv.IsNil() { |
| return "nil" |
| } |
| pv := reflect.Indirect(rv).Interface() |
| return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) |
| } |
| func (m *Timestamp) Marshal() (dAtA []byte, err error) { |
| size := m.Size() |
| dAtA = make([]byte, size) |
| n, err := m.MarshalTo(dAtA) |
| if err != nil { |
| return nil, err |
| } |
| return dAtA[:n], nil |
| } |
| |
| func (m *Timestamp) MarshalTo(dAtA []byte) (int, error) { |
| var i int |
| _ = i |
| var l int |
| _ = l |
| if m.Seconds != 0 { |
| dAtA[i] = 0x8 |
| i++ |
| i = encodeVarintTimestamp(dAtA, i, uint64(m.Seconds)) |
| } |
| if m.Nanos != 0 { |
| dAtA[i] = 0x10 |
| i++ |
| i = encodeVarintTimestamp(dAtA, i, uint64(m.Nanos)) |
| } |
| if m.XXX_unrecognized != nil { |
| i += copy(dAtA[i:], m.XXX_unrecognized) |
| } |
| return i, nil |
| } |
| |
| func encodeVarintTimestamp(dAtA []byte, offset int, v uint64) int { |
| for v >= 1<<7 { |
| dAtA[offset] = uint8(v&0x7f | 0x80) |
| v >>= 7 |
| offset++ |
| } |
| dAtA[offset] = uint8(v) |
| return offset + 1 |
| } |
| func (m *Timestamp) Size() (n int) { |
| var l int |
| _ = l |
| if m.Seconds != 0 { |
| n += 1 + sovTimestamp(uint64(m.Seconds)) |
| } |
| if m.Nanos != 0 { |
| n += 1 + sovTimestamp(uint64(m.Nanos)) |
| } |
| if m.XXX_unrecognized != nil { |
| n += len(m.XXX_unrecognized) |
| } |
| return n |
| } |
| |
| func sovTimestamp(x uint64) (n int) { |
| for { |
| n++ |
| x >>= 7 |
| if x == 0 { |
| break |
| } |
| } |
| return n |
| } |
| func sozTimestamp(x uint64) (n int) { |
| return sovTimestamp(uint64((x << 1) ^ uint64((int64(x) >> 63)))) |
| } |
| func (m *Timestamp) Unmarshal(dAtA []byte) error { |
| l := len(dAtA) |
| iNdEx := 0 |
| for iNdEx < l { |
| preIndex := iNdEx |
| var wire uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowTimestamp |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| wire |= (uint64(b) & 0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| fieldNum := int32(wire >> 3) |
| wireType := int(wire & 0x7) |
| if wireType == 4 { |
| return fmt.Errorf("proto: Timestamp: wiretype end group for non-group") |
| } |
| if fieldNum <= 0 { |
| return fmt.Errorf("proto: Timestamp: illegal tag %d (wire type %d)", fieldNum, wire) |
| } |
| switch fieldNum { |
| case 1: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Seconds", wireType) |
| } |
| m.Seconds = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowTimestamp |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Seconds |= (int64(b) & 0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| case 2: |
| if wireType != 0 { |
| return fmt.Errorf("proto: wrong wireType = %d for field Nanos", wireType) |
| } |
| m.Nanos = 0 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return ErrIntOverflowTimestamp |
| } |
| if iNdEx >= l { |
| return io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| m.Nanos |= (int32(b) & 0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| default: |
| iNdEx = preIndex |
| skippy, err := skipTimestamp(dAtA[iNdEx:]) |
| if err != nil { |
| return err |
| } |
| if skippy < 0 { |
| return ErrInvalidLengthTimestamp |
| } |
| if (iNdEx + skippy) > l { |
| return io.ErrUnexpectedEOF |
| } |
| m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) |
| iNdEx += skippy |
| } |
| } |
| |
| if iNdEx > l { |
| return io.ErrUnexpectedEOF |
| } |
| return nil |
| } |
| func skipTimestamp(dAtA []byte) (n int, err error) { |
| l := len(dAtA) |
| iNdEx := 0 |
| for iNdEx < l { |
| var wire uint64 |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return 0, ErrIntOverflowTimestamp |
| } |
| if iNdEx >= l { |
| return 0, io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| wire |= (uint64(b) & 0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| wireType := int(wire & 0x7) |
| switch wireType { |
| case 0: |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return 0, ErrIntOverflowTimestamp |
| } |
| if iNdEx >= l { |
| return 0, io.ErrUnexpectedEOF |
| } |
| iNdEx++ |
| if dAtA[iNdEx-1] < 0x80 { |
| break |
| } |
| } |
| return iNdEx, nil |
| case 1: |
| iNdEx += 8 |
| return iNdEx, nil |
| case 2: |
| var length int |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return 0, ErrIntOverflowTimestamp |
| } |
| if iNdEx >= l { |
| return 0, io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| length |= (int(b) & 0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| iNdEx += length |
| if length < 0 { |
| return 0, ErrInvalidLengthTimestamp |
| } |
| return iNdEx, nil |
| case 3: |
| for { |
| var innerWire uint64 |
| var start int = iNdEx |
| for shift := uint(0); ; shift += 7 { |
| if shift >= 64 { |
| return 0, ErrIntOverflowTimestamp |
| } |
| if iNdEx >= l { |
| return 0, io.ErrUnexpectedEOF |
| } |
| b := dAtA[iNdEx] |
| iNdEx++ |
| innerWire |= (uint64(b) & 0x7F) << shift |
| if b < 0x80 { |
| break |
| } |
| } |
| innerWireType := int(innerWire & 0x7) |
| if innerWireType == 4 { |
| break |
| } |
| next, err := skipTimestamp(dAtA[start:]) |
| if err != nil { |
| return 0, err |
| } |
| iNdEx = start + next |
| } |
| return iNdEx, nil |
| case 4: |
| return iNdEx, nil |
| case 5: |
| iNdEx += 4 |
| return iNdEx, nil |
| default: |
| return 0, fmt.Errorf("proto: illegal wireType %d", wireType) |
| } |
| } |
| panic("unreachable") |
| } |
| |
| var ( |
| ErrInvalidLengthTimestamp = fmt.Errorf("proto: negative length found during unmarshaling") |
| ErrIntOverflowTimestamp = fmt.Errorf("proto: integer overflow") |
| ) |
| |
| func init() { |
| proto.RegisterFile("google/protobuf/timestamp.proto", fileDescriptor_timestamp_0a0a9bc758317e91) |
| } |
| |
| var fileDescriptor_timestamp_0a0a9bc758317e91 = []byte{ |
| // 216 bytes of a gzipped FileDescriptorProto |
| 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xcf, 0xcf, 0x4f, |
| 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xc9, 0xcc, 0x4d, |
| 0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0xd0, 0x03, 0x0b, 0x09, 0xf1, 0x43, 0x14, 0xe8, 0xc1, 0x14, 0x28, |
| 0x59, 0x73, 0x71, 0x86, 0xc0, 0xd4, 0x08, 0x49, 0x70, 0xb1, 0x17, 0xa7, 0x26, 0xe7, 0xe7, 0xa5, |
| 0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0xc1, 0xb8, 0x42, 0x22, 0x5c, 0xac, 0x79, 0x89, |
| 0x79, 0xf9, 0xc5, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xac, 0x41, 0x10, 0x8e, 0x53, 0x0b, 0xe3, 0x85, |
| 0x87, 0x72, 0x0c, 0x37, 0x1e, 0xca, 0x31, 0x7c, 0x78, 0x28, 0xc7, 0xb8, 0xe2, 0x91, 0x1c, 0xe3, |
| 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0xf8, 0xe2, 0x91, 0x1c, |
| 0xc3, 0x87, 0x47, 0x72, 0x8c, 0x2b, 0x1e, 0xcb, 0x31, 0x9e, 0x78, 0x2c, 0xc7, 0xc8, 0x25, 0x9c, |
| 0x9c, 0x9f, 0xab, 0x87, 0xe6, 0x00, 0x27, 0x3e, 0xb8, 0xf5, 0x01, 0x20, 0xa1, 0x00, 0xc6, 0x28, |
| 0xd6, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x1f, 0x8c, 0x8c, 0x8b, 0x98, 0x98, 0xdd, 0x03, 0x9c, 0x56, |
| 0x31, 0xc9, 0xb9, 0x43, 0xf4, 0x04, 0x40, 0xf5, 0xe8, 0x85, 0xa7, 0xe6, 0xe4, 0x78, 0xe7, 0xe5, |
| 0x97, 0xe7, 0x85, 0x80, 0x54, 0x26, 0xb1, 0x81, 0x0d, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, |
| 0x40, 0xae, 0xf1, 0x42, 0xfe, 0x00, 0x00, 0x00, |
| } |