duration.pb.go 6.3 KB

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