PageRenderTime 71ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/github.com/gogo/protobuf/types/timestamp.pb.go

https://gitlab.com/unofficial-mirrors/kubernetes
Go | 504 lines | 406 code | 20 blank | 78 comment | 109 complexity | c50f3643eef696e970b4dc50e19bc2b7 MD5 | raw file
  1. // Code generated by protoc-gen-gogo.
  2. // source: timestamp.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package types is a generated protocol buffer package.
  6. It is generated from these files:
  7. timestamp.proto
  8. It has these top-level messages:
  9. Timestamp
  10. */
  11. package types
  12. import proto "github.com/gogo/protobuf/proto"
  13. import fmt "fmt"
  14. import math "math"
  15. import strings "strings"
  16. import reflect "reflect"
  17. import io "io"
  18. // Reference imports to suppress errors if they are not otherwise used.
  19. var _ = proto.Marshal
  20. var _ = fmt.Errorf
  21. var _ = math.Inf
  22. // This is a compile-time assertion to ensure that this generated file
  23. // is compatible with the proto package it is being compiled against.
  24. // A compilation error at this line likely means your copy of the
  25. // proto package needs to be updated.
  26. const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
  27. // A Timestamp represents a point in time independent of any time zone
  28. // or calendar, represented as seconds and fractions of seconds at
  29. // nanosecond resolution in UTC Epoch time. It is encoded using the
  30. // Proleptic Gregorian Calendar which extends the Gregorian calendar
  31. // backwards to year one. It is encoded assuming all minutes are 60
  32. // seconds long, i.e. leap seconds are "smeared" so that no leap second
  33. // table is needed for interpretation. Range is from
  34. // 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
  35. // By restricting to that range, we ensure that we can convert to
  36. // and from RFC 3339 date strings.
  37. // See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
  38. //
  39. // Example 1: Compute Timestamp from POSIX `time()`.
  40. //
  41. // Timestamp timestamp;
  42. // timestamp.set_seconds(time(NULL));
  43. // timestamp.set_nanos(0);
  44. //
  45. // Example 2: Compute Timestamp from POSIX `gettimeofday()`.
  46. //
  47. // struct timeval tv;
  48. // gettimeofday(&tv, NULL);
  49. //
  50. // Timestamp timestamp;
  51. // timestamp.set_seconds(tv.tv_sec);
  52. // timestamp.set_nanos(tv.tv_usec * 1000);
  53. //
  54. // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
  55. //
  56. // FILETIME ft;
  57. // GetSystemTimeAsFileTime(&ft);
  58. // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
  59. //
  60. // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
  61. // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
  62. // Timestamp timestamp;
  63. // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
  64. // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
  65. //
  66. // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
  67. //
  68. // long millis = System.currentTimeMillis();
  69. //
  70. // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
  71. // .setNanos((int) ((millis % 1000) * 1000000)).build();
  72. //
  73. //
  74. // Example 5: Compute Timestamp from current time in Python.
  75. //
  76. // timestamp = Timestamp()
  77. // timestamp.GetCurrentTime()
  78. //
  79. //
  80. type Timestamp struct {
  81. // Represents seconds of UTC time since Unix epoch
  82. // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
  83. // 9999-12-31T23:59:59Z inclusive.
  84. Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
  85. // Non-negative fractions of a second at nanosecond resolution. Negative
  86. // second values with fractions must still have non-negative nanos values
  87. // that count forward in time. Must be from 0 to 999,999,999
  88. // inclusive.
  89. Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
  90. }
  91. func (m *Timestamp) Reset() { *m = Timestamp{} }
  92. func (*Timestamp) ProtoMessage() {}
  93. func (*Timestamp) Descriptor() ([]byte, []int) { return fileDescriptorTimestamp, []int{0} }
  94. func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" }
  95. func (m *Timestamp) GetSeconds() int64 {
  96. if m != nil {
  97. return m.Seconds
  98. }
  99. return 0
  100. }
  101. func (m *Timestamp) GetNanos() int32 {
  102. if m != nil {
  103. return m.Nanos
  104. }
  105. return 0
  106. }
  107. func init() {
  108. proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp")
  109. }
  110. func (this *Timestamp) Compare(that interface{}) int {
  111. if that == nil {
  112. if this == nil {
  113. return 0
  114. }
  115. return 1
  116. }
  117. that1, ok := that.(*Timestamp)
  118. if !ok {
  119. that2, ok := that.(Timestamp)
  120. if ok {
  121. that1 = &that2
  122. } else {
  123. return 1
  124. }
  125. }
  126. if that1 == nil {
  127. if this == nil {
  128. return 0
  129. }
  130. return 1
  131. } else if this == nil {
  132. return -1
  133. }
  134. if this.Seconds != that1.Seconds {
  135. if this.Seconds < that1.Seconds {
  136. return -1
  137. }
  138. return 1
  139. }
  140. if this.Nanos != that1.Nanos {
  141. if this.Nanos < that1.Nanos {
  142. return -1
  143. }
  144. return 1
  145. }
  146. return 0
  147. }
  148. func (this *Timestamp) Equal(that interface{}) bool {
  149. if that == nil {
  150. if this == nil {
  151. return true
  152. }
  153. return false
  154. }
  155. that1, ok := that.(*Timestamp)
  156. if !ok {
  157. that2, ok := that.(Timestamp)
  158. if ok {
  159. that1 = &that2
  160. } else {
  161. return false
  162. }
  163. }
  164. if that1 == nil {
  165. if this == nil {
  166. return true
  167. }
  168. return false
  169. } else if this == nil {
  170. return false
  171. }
  172. if this.Seconds != that1.Seconds {
  173. return false
  174. }
  175. if this.Nanos != that1.Nanos {
  176. return false
  177. }
  178. return true
  179. }
  180. func (this *Timestamp) GoString() string {
  181. if this == nil {
  182. return "nil"
  183. }
  184. s := make([]string, 0, 6)
  185. s = append(s, "&types.Timestamp{")
  186. s = append(s, "Seconds: "+fmt.Sprintf("%#v", this.Seconds)+",\n")
  187. s = append(s, "Nanos: "+fmt.Sprintf("%#v", this.Nanos)+",\n")
  188. s = append(s, "}")
  189. return strings.Join(s, "")
  190. }
  191. func valueToGoStringTimestamp(v interface{}, typ string) string {
  192. rv := reflect.ValueOf(v)
  193. if rv.IsNil() {
  194. return "nil"
  195. }
  196. pv := reflect.Indirect(rv).Interface()
  197. return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
  198. }
  199. func (m *Timestamp) Marshal() (dAtA []byte, err error) {
  200. size := m.Size()
  201. dAtA = make([]byte, size)
  202. n, err := m.MarshalTo(dAtA)
  203. if err != nil {
  204. return nil, err
  205. }
  206. return dAtA[:n], nil
  207. }
  208. func (m *Timestamp) MarshalTo(dAtA []byte) (int, error) {
  209. var i int
  210. _ = i
  211. var l int
  212. _ = l
  213. if m.Seconds != 0 {
  214. dAtA[i] = 0x8
  215. i++
  216. i = encodeVarintTimestamp(dAtA, i, uint64(m.Seconds))
  217. }
  218. if m.Nanos != 0 {
  219. dAtA[i] = 0x10
  220. i++
  221. i = encodeVarintTimestamp(dAtA, i, uint64(m.Nanos))
  222. }
  223. return i, nil
  224. }
  225. func encodeFixed64Timestamp(dAtA []byte, offset int, v uint64) int {
  226. dAtA[offset] = uint8(v)
  227. dAtA[offset+1] = uint8(v >> 8)
  228. dAtA[offset+2] = uint8(v >> 16)
  229. dAtA[offset+3] = uint8(v >> 24)
  230. dAtA[offset+4] = uint8(v >> 32)
  231. dAtA[offset+5] = uint8(v >> 40)
  232. dAtA[offset+6] = uint8(v >> 48)
  233. dAtA[offset+7] = uint8(v >> 56)
  234. return offset + 8
  235. }
  236. func encodeFixed32Timestamp(dAtA []byte, offset int, v uint32) int {
  237. dAtA[offset] = uint8(v)
  238. dAtA[offset+1] = uint8(v >> 8)
  239. dAtA[offset+2] = uint8(v >> 16)
  240. dAtA[offset+3] = uint8(v >> 24)
  241. return offset + 4
  242. }
  243. func encodeVarintTimestamp(dAtA []byte, offset int, v uint64) int {
  244. for v >= 1<<7 {
  245. dAtA[offset] = uint8(v&0x7f | 0x80)
  246. v >>= 7
  247. offset++
  248. }
  249. dAtA[offset] = uint8(v)
  250. return offset + 1
  251. }
  252. func (m *Timestamp) Size() (n int) {
  253. var l int
  254. _ = l
  255. if m.Seconds != 0 {
  256. n += 1 + sovTimestamp(uint64(m.Seconds))
  257. }
  258. if m.Nanos != 0 {
  259. n += 1 + sovTimestamp(uint64(m.Nanos))
  260. }
  261. return n
  262. }
  263. func sovTimestamp(x uint64) (n int) {
  264. for {
  265. n++
  266. x >>= 7
  267. if x == 0 {
  268. break
  269. }
  270. }
  271. return n
  272. }
  273. func sozTimestamp(x uint64) (n int) {
  274. return sovTimestamp(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  275. }
  276. func (m *Timestamp) Unmarshal(dAtA []byte) error {
  277. l := len(dAtA)
  278. iNdEx := 0
  279. for iNdEx < l {
  280. preIndex := iNdEx
  281. var wire uint64
  282. for shift := uint(0); ; shift += 7 {
  283. if shift >= 64 {
  284. return ErrIntOverflowTimestamp
  285. }
  286. if iNdEx >= l {
  287. return io.ErrUnexpectedEOF
  288. }
  289. b := dAtA[iNdEx]
  290. iNdEx++
  291. wire |= (uint64(b) & 0x7F) << shift
  292. if b < 0x80 {
  293. break
  294. }
  295. }
  296. fieldNum := int32(wire >> 3)
  297. wireType := int(wire & 0x7)
  298. if wireType == 4 {
  299. return fmt.Errorf("proto: Timestamp: wiretype end group for non-group")
  300. }
  301. if fieldNum <= 0 {
  302. return fmt.Errorf("proto: Timestamp: illegal tag %d (wire type %d)", fieldNum, wire)
  303. }
  304. switch fieldNum {
  305. case 1:
  306. if wireType != 0 {
  307. return fmt.Errorf("proto: wrong wireType = %d for field Seconds", wireType)
  308. }
  309. m.Seconds = 0
  310. for shift := uint(0); ; shift += 7 {
  311. if shift >= 64 {
  312. return ErrIntOverflowTimestamp
  313. }
  314. if iNdEx >= l {
  315. return io.ErrUnexpectedEOF
  316. }
  317. b := dAtA[iNdEx]
  318. iNdEx++
  319. m.Seconds |= (int64(b) & 0x7F) << shift
  320. if b < 0x80 {
  321. break
  322. }
  323. }
  324. case 2:
  325. if wireType != 0 {
  326. return fmt.Errorf("proto: wrong wireType = %d for field Nanos", wireType)
  327. }
  328. m.Nanos = 0
  329. for shift := uint(0); ; shift += 7 {
  330. if shift >= 64 {
  331. return ErrIntOverflowTimestamp
  332. }
  333. if iNdEx >= l {
  334. return io.ErrUnexpectedEOF
  335. }
  336. b := dAtA[iNdEx]
  337. iNdEx++
  338. m.Nanos |= (int32(b) & 0x7F) << shift
  339. if b < 0x80 {
  340. break
  341. }
  342. }
  343. default:
  344. iNdEx = preIndex
  345. skippy, err := skipTimestamp(dAtA[iNdEx:])
  346. if err != nil {
  347. return err
  348. }
  349. if skippy < 0 {
  350. return ErrInvalidLengthTimestamp
  351. }
  352. if (iNdEx + skippy) > l {
  353. return io.ErrUnexpectedEOF
  354. }
  355. iNdEx += skippy
  356. }
  357. }
  358. if iNdEx > l {
  359. return io.ErrUnexpectedEOF
  360. }
  361. return nil
  362. }
  363. func skipTimestamp(dAtA []byte) (n int, err error) {
  364. l := len(dAtA)
  365. iNdEx := 0
  366. for iNdEx < l {
  367. var wire uint64
  368. for shift := uint(0); ; shift += 7 {
  369. if shift >= 64 {
  370. return 0, ErrIntOverflowTimestamp
  371. }
  372. if iNdEx >= l {
  373. return 0, io.ErrUnexpectedEOF
  374. }
  375. b := dAtA[iNdEx]
  376. iNdEx++
  377. wire |= (uint64(b) & 0x7F) << shift
  378. if b < 0x80 {
  379. break
  380. }
  381. }
  382. wireType := int(wire & 0x7)
  383. switch wireType {
  384. case 0:
  385. for shift := uint(0); ; shift += 7 {
  386. if shift >= 64 {
  387. return 0, ErrIntOverflowTimestamp
  388. }
  389. if iNdEx >= l {
  390. return 0, io.ErrUnexpectedEOF
  391. }
  392. iNdEx++
  393. if dAtA[iNdEx-1] < 0x80 {
  394. break
  395. }
  396. }
  397. return iNdEx, nil
  398. case 1:
  399. iNdEx += 8
  400. return iNdEx, nil
  401. case 2:
  402. var length int
  403. for shift := uint(0); ; shift += 7 {
  404. if shift >= 64 {
  405. return 0, ErrIntOverflowTimestamp
  406. }
  407. if iNdEx >= l {
  408. return 0, io.ErrUnexpectedEOF
  409. }
  410. b := dAtA[iNdEx]
  411. iNdEx++
  412. length |= (int(b) & 0x7F) << shift
  413. if b < 0x80 {
  414. break
  415. }
  416. }
  417. iNdEx += length
  418. if length < 0 {
  419. return 0, ErrInvalidLengthTimestamp
  420. }
  421. return iNdEx, nil
  422. case 3:
  423. for {
  424. var innerWire uint64
  425. var start int = iNdEx
  426. for shift := uint(0); ; shift += 7 {
  427. if shift >= 64 {
  428. return 0, ErrIntOverflowTimestamp
  429. }
  430. if iNdEx >= l {
  431. return 0, io.ErrUnexpectedEOF
  432. }
  433. b := dAtA[iNdEx]
  434. iNdEx++
  435. innerWire |= (uint64(b) & 0x7F) << shift
  436. if b < 0x80 {
  437. break
  438. }
  439. }
  440. innerWireType := int(innerWire & 0x7)
  441. if innerWireType == 4 {
  442. break
  443. }
  444. next, err := skipTimestamp(dAtA[start:])
  445. if err != nil {
  446. return 0, err
  447. }
  448. iNdEx = start + next
  449. }
  450. return iNdEx, nil
  451. case 4:
  452. return iNdEx, nil
  453. case 5:
  454. iNdEx += 4
  455. return iNdEx, nil
  456. default:
  457. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  458. }
  459. }
  460. panic("unreachable")
  461. }
  462. var (
  463. ErrInvalidLengthTimestamp = fmt.Errorf("proto: negative length found during unmarshaling")
  464. ErrIntOverflowTimestamp = fmt.Errorf("proto: integer overflow")
  465. )
  466. func init() { proto.RegisterFile("timestamp.proto", fileDescriptorTimestamp) }
  467. var fileDescriptorTimestamp = []byte{
  468. // 205 bytes of a gzipped FileDescriptorProto
  469. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0xc9, 0xcc, 0x4d,
  470. 0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4f, 0xcf, 0xcf,
  471. 0x4f, 0xcf, 0x49, 0x85, 0xf0, 0x92, 0x4a, 0xd3, 0x94, 0xac, 0xb9, 0x38, 0x43, 0x60, 0x6a, 0x84,
  472. 0x24, 0xb8, 0xd8, 0x8b, 0x53, 0x93, 0xf3, 0xf3, 0x52, 0x8a, 0x25, 0x18, 0x15, 0x18, 0x35, 0x98,
  473. 0x83, 0x60, 0x5c, 0x21, 0x11, 0x2e, 0xd6, 0xbc, 0xc4, 0xbc, 0xfc, 0x62, 0x09, 0x26, 0x05, 0x46,
  474. 0x0d, 0xd6, 0x20, 0x08, 0xc7, 0xa9, 0x81, 0xf1, 0xc2, 0x43, 0x39, 0x86, 0x1b, 0x0f, 0xe5, 0x18,
  475. 0x3e, 0x3c, 0x94, 0x63, 0x5c, 0xf1, 0x48, 0x8e, 0xf1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4,
  476. 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x7c, 0xf1, 0x48, 0x8e, 0xe1, 0xc3, 0x23, 0x39, 0xc6, 0x15, 0x8f,
  477. 0xe5, 0x18, 0xb9, 0x84, 0x93, 0xf3, 0x73, 0xf5, 0xd0, 0x2c, 0x77, 0xe2, 0x83, 0x5b, 0x1d, 0x00,
  478. 0x12, 0x0a, 0x60, 0x8c, 0x62, 0x2d, 0xa9, 0x2c, 0x48, 0x2d, 0xfe, 0xc1, 0xc8, 0xb8, 0x88, 0x89,
  479. 0xd9, 0x3d, 0xc0, 0x69, 0x15, 0x93, 0x9c, 0x3b, 0x44, 0x4f, 0x00, 0x54, 0x8f, 0x5e, 0x78, 0x6a,
  480. 0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0x48, 0x65, 0x12, 0x1b, 0xd8, 0x30, 0x63, 0x40,
  481. 0x00, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xa2, 0x42, 0xda, 0xea, 0x00, 0x00, 0x00,
  482. }