1// Code generated by protoc-gen-go. DO NOT EDIT. 2// source: google/protobuf/duration.proto 3 4package duration // import "github.com/golang/protobuf/ptypes/duration" 5 6import proto "github.com/golang/protobuf/proto" 7import fmt "fmt" 8import math "math" 9 10// Reference imports to suppress errors if they are not otherwise used. 11var _ = proto.Marshal 12var _ = fmt.Errorf 13var _ = math.Inf 14 15// This is a compile-time assertion to ensure that this generated file 16// is compatible with the proto package it is being compiled against. 17// A compilation error at this line likely means your copy of the 18// proto package needs to be updated. 19const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package 20 21// A Duration represents a signed, fixed-length span of time represented 22// as a count of seconds and fractions of seconds at nanosecond 23// resolution. It is independent of any calendar and concepts like "day" 24// or "month". It is related to Timestamp in that the difference between 25// two Timestamp values is a Duration and it can be added or subtracted 26// from a Timestamp. Range is approximately +-10,000 years. 27// 28// # Examples 29// 30// Example 1: Compute Duration from two Timestamps in pseudo code. 31// 32// Timestamp start = ...; 33// Timestamp end = ...; 34// Duration duration = ...; 35// 36// duration.seconds = end.seconds - start.seconds; 37// duration.nanos = end.nanos - start.nanos; 38// 39// if (duration.seconds < 0 && duration.nanos > 0) { 40// duration.seconds += 1; 41// duration.nanos -= 1000000000; 42// } else if (durations.seconds > 0 && duration.nanos < 0) { 43// duration.seconds -= 1; 44// duration.nanos += 1000000000; 45// } 46// 47// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. 48// 49// Timestamp start = ...; 50// Duration duration = ...; 51// Timestamp end = ...; 52// 53// end.seconds = start.seconds + duration.seconds; 54// end.nanos = start.nanos + duration.nanos; 55// 56// if (end.nanos < 0) { 57// end.seconds -= 1; 58// end.nanos += 1000000000; 59// } else if (end.nanos >= 1000000000) { 60// end.seconds += 1; 61// end.nanos -= 1000000000; 62// } 63// 64// Example 3: Compute Duration from datetime.timedelta in Python. 65// 66// td = datetime.timedelta(days=3, minutes=10) 67// duration = Duration() 68// duration.FromTimedelta(td) 69// 70// # JSON Mapping 71// 72// In JSON format, the Duration type is encoded as a string rather than an 73// object, where the string ends in the suffix "s" (indicating seconds) and 74// is preceded by the number of seconds, with nanoseconds expressed as 75// fractional seconds. For example, 3 seconds with 0 nanoseconds should be 76// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should 77// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 78// microsecond should be expressed in JSON format as "3.000001s". 79// 80// 81type Duration struct { 82 // Signed seconds of the span of time. Must be from -315,576,000,000 83 // to +315,576,000,000 inclusive. Note: these bounds are computed from: 84 // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years 85 Seconds int64 `protobuf:"varint,1,opt,name=seconds" json:"seconds,omitempty"` 86 // Signed fractions of a second at nanosecond resolution of the span 87 // of time. Durations less than one second are represented with a 0 88 // `seconds` field and a positive or negative `nanos` field. For durations 89 // of one second or more, a non-zero value for the `nanos` field must be 90 // of the same sign as the `seconds` field. Must be from -999,999,999 91 // to +999,999,999 inclusive. 92 Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"` 93 XXX_NoUnkeyedLiteral struct{} `json:"-"` 94 XXX_unrecognized []byte `json:"-"` 95 XXX_sizecache int32 `json:"-"` 96} 97 98func (m *Duration) Reset() { *m = Duration{} } 99func (m *Duration) String() string { return proto.CompactTextString(m) } 100func (*Duration) ProtoMessage() {} 101func (*Duration) Descriptor() ([]byte, []int) { 102 return fileDescriptor_duration_e7d612259e3f0613, []int{0} 103} 104func (*Duration) XXX_WellKnownType() string { return "Duration" } 105func (m *Duration) XXX_Unmarshal(b []byte) error { 106 return xxx_messageInfo_Duration.Unmarshal(m, b) 107} 108func (m *Duration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 109 return xxx_messageInfo_Duration.Marshal(b, m, deterministic) 110} 111func (dst *Duration) XXX_Merge(src proto.Message) { 112 xxx_messageInfo_Duration.Merge(dst, src) 113} 114func (m *Duration) XXX_Size() int { 115 return xxx_messageInfo_Duration.Size(m) 116} 117func (m *Duration) XXX_DiscardUnknown() { 118 xxx_messageInfo_Duration.DiscardUnknown(m) 119} 120 121var xxx_messageInfo_Duration proto.InternalMessageInfo 122 123func (m *Duration) GetSeconds() int64 { 124 if m != nil { 125 return m.Seconds 126 } 127 return 0 128} 129 130func (m *Duration) GetNanos() int32 { 131 if m != nil { 132 return m.Nanos 133 } 134 return 0 135} 136 137func init() { 138 proto.RegisterType((*Duration)(nil), "google.protobuf.Duration") 139} 140 141func init() { 142 proto.RegisterFile("google/protobuf/duration.proto", fileDescriptor_duration_e7d612259e3f0613) 143} 144 145var fileDescriptor_duration_e7d612259e3f0613 = []byte{ 146 // 190 bytes of a gzipped FileDescriptorProto 147 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f, 148 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0x29, 0x2d, 0x4a, 149 0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0x56, 150 0x5c, 0x1c, 0x2e, 0x50, 0x25, 0x42, 0x12, 0x5c, 0xec, 0xc5, 0xa9, 0xc9, 0xf9, 0x79, 0x29, 0xc5, 151 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x30, 0xae, 0x90, 0x08, 0x17, 0x6b, 0x5e, 0x62, 0x5e, 152 0x7e, 0xb1, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x6b, 0x10, 0x84, 0xe3, 0x54, 0xc3, 0x25, 0x9c, 0x9c, 153 0x9f, 0xab, 0x87, 0x66, 0xa4, 0x13, 0x2f, 0xcc, 0xc0, 0x00, 0x90, 0x48, 0x00, 0x63, 0x94, 0x56, 154 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x4e, 0x62, 0x5e, 155 0x3a, 0xc2, 0x7d, 0x05, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x70, 0x67, 0xfe, 0x60, 0x64, 0x5c, 0xc4, 156 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0x62, 0x6e, 0x00, 0x54, 0xa9, 0x5e, 0x78, 157 0x6a, 0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0x48, 0x4b, 0x12, 0x1b, 0xd8, 0x0c, 0x63, 158 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x84, 0x30, 0xff, 0xf3, 0x00, 0x00, 0x00, 159} 160