OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 20 matching lines...) Expand all Loading... |
31 syntax = "proto3"; | 31 syntax = "proto3"; |
32 | 32 |
33 package google.protobuf; | 33 package google.protobuf; |
34 | 34 |
35 option csharp_namespace = "Google.Protobuf.WellKnownTypes"; | 35 option csharp_namespace = "Google.Protobuf.WellKnownTypes"; |
36 option cc_enable_arenas = true; | 36 option cc_enable_arenas = true; |
37 option go_package = "github.com/golang/protobuf/ptypes/timestamp"; | 37 option go_package = "github.com/golang/protobuf/ptypes/timestamp"; |
38 option java_package = "com.google.protobuf"; | 38 option java_package = "com.google.protobuf"; |
39 option java_outer_classname = "TimestampProto"; | 39 option java_outer_classname = "TimestampProto"; |
40 option java_multiple_files = true; | 40 option java_multiple_files = true; |
41 option java_generate_equals_and_hash = true; | |
42 option objc_class_prefix = "GPB"; | 41 option objc_class_prefix = "GPB"; |
43 | 42 |
44 // A Timestamp represents a point in time independent of any time zone | 43 // A Timestamp represents a point in time independent of any time zone |
45 // or calendar, represented as seconds and fractions of seconds at | 44 // or calendar, represented as seconds and fractions of seconds at |
46 // nanosecond resolution in UTC Epoch time. It is encoded using the | 45 // nanosecond resolution in UTC Epoch time. It is encoded using the |
47 // Proleptic Gregorian Calendar which extends the Gregorian calendar | 46 // Proleptic Gregorian Calendar which extends the Gregorian calendar |
48 // backwards to year one. It is encoded assuming all minutes are 60 | 47 // backwards to year one. It is encoded assuming all minutes are 60 |
49 // seconds long, i.e. leap seconds are "smeared" so that no leap second | 48 // seconds long, i.e. leap seconds are "smeared" so that no leap second |
50 // table is needed for interpretation. Range is from | 49 // table is needed for interpretation. Range is from |
51 // 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. | 50 // 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. | 82 // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. |
84 // | 83 // |
85 // long millis = System.currentTimeMillis(); | 84 // long millis = System.currentTimeMillis(); |
86 // | 85 // |
87 // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) | 86 // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) |
88 // .setNanos((int) ((millis % 1000) * 1000000)).build(); | 87 // .setNanos((int) ((millis % 1000) * 1000000)).build(); |
89 // | 88 // |
90 // | 89 // |
91 // Example 5: Compute Timestamp from current time in Python. | 90 // Example 5: Compute Timestamp from current time in Python. |
92 // | 91 // |
93 // now = time.time() | 92 // timestamp = Timestamp() |
94 // seconds = int(now) | 93 // timestamp.GetCurrentTime() |
95 // nanos = int((now - seconds) * 10**9) | |
96 // timestamp = Timestamp(seconds=seconds, nanos=nanos) | |
97 // | 94 // |
98 // | 95 // |
99 message Timestamp { | 96 message Timestamp { |
100 | 97 |
101 // Represents seconds of UTC time since Unix epoch | 98 // Represents seconds of UTC time since Unix epoch |
102 // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to | 99 // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to |
103 // 9999-12-31T23:59:59Z inclusive. | 100 // 9999-12-31T23:59:59Z inclusive. |
104 int64 seconds = 1; | 101 int64 seconds = 1; |
105 | 102 |
106 // Non-negative fractions of a second at nanosecond resolution. Negative | 103 // Non-negative fractions of a second at nanosecond resolution. Negative |
107 // second values with fractions must still have non-negative nanos values | 104 // second values with fractions must still have non-negative nanos values |
108 // that count forward in time. Must be from 0 to 999,999,999 | 105 // that count forward in time. Must be from 0 to 999,999,999 |
109 // inclusive. | 106 // inclusive. |
110 int32 nanos = 2; | 107 int32 nanos = 2; |
111 } | 108 } |
OLD | NEW |