1// Code generated by protoc-gen-go. DO NOT EDIT. 2// source: github.com/golang/protobuf/ptypes/duration/duration.proto 3 4/* 5Package duration is a generated protocol buffer package. 6 7It is generated from these files: 8 github.com/golang/protobuf/ptypes/duration/duration.proto 9 10It has these top-level messages: 11 Duration 12*/ 13package duration 14 15import proto "github.com/golang/protobuf/proto" 16import fmt "fmt" 17import math "math" 18 19// Reference imports to suppress errors if they are not otherwise used. 20var _ = proto.Marshal 21var _ = fmt.Errorf 22var _ = 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. 28const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package 29 30// A Duration represents a signed, fixed-length span of time represented 31// as a count of seconds and fractions of seconds at nanosecond 32// resolution. It is independent of any calendar and concepts like "day" 33// or "month". It is related to Timestamp in that the difference between 34// two Timestamp values is a Duration and it can be added or subtracted 35// from a Timestamp. Range is approximately +-10,000 years. 36// 37// # Examples 38// 39// Example 1: Compute Duration from two Timestamps in pseudo code. 40// 41// Timestamp start = ...; 42// Timestamp end = ...; 43// Duration duration = ...; 44// 45// duration.seconds = end.seconds - start.seconds; 46// duration.nanos = end.nanos - start.nanos; 47// 48// if (duration.seconds < 0 && duration.nanos > 0) { 49// duration.seconds += 1; 50// duration.nanos -= 1000000000; 51// } else if (durations.seconds > 0 && duration.nanos < 0) { 52// duration.seconds -= 1; 53// duration.nanos += 1000000000; 54// } 55// 56// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. 57// 58// Timestamp start = ...; 59// Duration duration = ...; 60// Timestamp end = ...; 61// 62// end.seconds = start.seconds + duration.seconds; 63// end.nanos = start.nanos + duration.nanos; 64// 65// if (end.nanos < 0) { 66// end.seconds -= 1; 67// end.nanos += 1000000000; 68// } else if (end.nanos >= 1000000000) { 69// end.seconds += 1; 70// end.nanos -= 1000000000; 71// } 72// 73// Example 3: Compute Duration from datetime.timedelta in Python. 74// 75// td = datetime.timedelta(days=3, minutes=10) 76// duration = Duration() 77// duration.FromTimedelta(td) 78// 79// # JSON Mapping 80// 81// In JSON format, the Duration type is encoded as a string rather than an 82// object, where the string ends in the suffix "s" (indicating seconds) and 83// is preceded by the number of seconds, with nanoseconds expressed as 84// fractional seconds. For example, 3 seconds with 0 nanoseconds should be 85// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should 86// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 87// microsecond should be expressed in JSON format as "3.000001s". 88// 89// 90type Duration struct { 91 // Signed seconds of the span of time. Must be from -315,576,000,000 92 // to +315,576,000,000 inclusive. Note: these bounds are computed from: 93 // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years 94 Seconds int64 `protobuf:"varint,1,opt,name=seconds" json:"seconds,omitempty"` 95 // Signed fractions of a second at nanosecond resolution of the span 96 // of time. Durations less than one second are represented with a 0 97 // `seconds` field and a positive or negative `nanos` field. For durations 98 // of one second or more, a non-zero value for the `nanos` field must be 99 // of the same sign as the `seconds` field. Must be from -999,999,999 100 // to +999,999,999 inclusive. 101 Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"` 102} 103 104func (m *Duration) Reset() { *m = Duration{} } 105func (m *Duration) String() string { return proto.CompactTextString(m) } 106func (*Duration) ProtoMessage() {} 107func (*Duration) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } 108func (*Duration) XXX_WellKnownType() string { return "Duration" } 109 110func (m *Duration) GetSeconds() int64 { 111 if m != nil { 112 return m.Seconds 113 } 114 return 0 115} 116 117func (m *Duration) GetNanos() int32 { 118 if m != nil { 119 return m.Nanos 120 } 121 return 0 122} 123 124func init() { 125 proto.RegisterType((*Duration)(nil), "google.protobuf.Duration") 126} 127 128func init() { 129 proto.RegisterFile("github.com/golang/protobuf/ptypes/duration/duration.proto", fileDescriptor0) 130} 131 132var fileDescriptor0 = []byte{ 133 // 189 bytes of a gzipped FileDescriptorProto 134 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x4c, 0xcf, 0x2c, 0xc9, 135 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x2f, 0x28, 136 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0x28, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x4f, 0x29, 137 0x2d, 0x4a, 0x2c, 0xc9, 0xcc, 0xcf, 0x83, 0x33, 0xf4, 0xc0, 0x2a, 0x84, 0xf8, 0xd3, 0xf3, 0xf3, 138 0xd3, 0x73, 0x52, 0xf5, 0x60, 0xea, 0x95, 0xac, 0xb8, 0x38, 0x5c, 0xa0, 0x4a, 0x84, 0x24, 0xb8, 139 0xd8, 0x8b, 0x53, 0x93, 0xf3, 0xf3, 0x52, 0x8a, 0x25, 0x18, 0x15, 0x18, 0x35, 0x98, 0x83, 0x60, 140 0x5c, 0x21, 0x11, 0x2e, 0xd6, 0xbc, 0xc4, 0xbc, 0xfc, 0x62, 0x09, 0x26, 0x05, 0x46, 0x0d, 0xd6, 141 0x20, 0x08, 0xc7, 0xa9, 0x86, 0x4b, 0x38, 0x39, 0x3f, 0x57, 0x0f, 0xcd, 0x48, 0x27, 0x5e, 0x98, 142 0x81, 0x01, 0x20, 0x91, 0x00, 0xc6, 0x28, 0x2d, 0xe2, 0xdd, 0xfb, 0x83, 0x91, 0x71, 0x11, 0x13, 143 0xb3, 0x7b, 0x80, 0xd3, 0x2a, 0x26, 0x39, 0x77, 0x88, 0xb9, 0x01, 0x50, 0xa5, 0x7a, 0xe1, 0xa9, 144 0x39, 0x39, 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x20, 0x2d, 0x49, 0x6c, 0x60, 0x33, 0x8c, 0x01, 145 0x01, 0x00, 0x00, 0xff, 0xff, 0x45, 0x5a, 0x81, 0x3d, 0x0e, 0x01, 0x00, 0x00, 146} 147