11
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
-
15
- ///
14
+ //
16
15
// Generated code. Do not modify.
17
- // source: google/protobuf/ timestamp.proto
16
+ // source: timestamp.proto
18
17
//
19
- // @dart = 2.12
20
- // ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
18
+ // @dart = 3.3
19
+
20
+ // ignore_for_file: annotate_overrides, camel_case_types, comment_references
21
+ // ignore_for_file: constant_identifier_names
22
+ // ignore_for_file: curly_braces_in_flow_control_structures
23
+ // ignore_for_file: deprecated_member_use_from_same_package
24
+ // ignore_for_file: implementation_imports, library_prefixes
25
+ // ignore_for_file: non_constant_identifier_names
21
26
22
27
import 'dart:core' as $core;
23
28
24
29
import 'package:fixnum/fixnum.dart' as $fixnum;
25
30
import 'package:protobuf/protobuf.dart' as $pb;
26
31
import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin;
27
32
28
- class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin {
29
- static final $pb.BuilderInfo _i = $pb.BuilderInfo (
30
- const $core.bool .fromEnvironment ('protobuf.omit_message_names' )
31
- ? ''
32
- : 'Timestamp' ,
33
- package: const $pb.PackageName (
34
- const $core.bool .fromEnvironment ('protobuf.omit_message_names' )
35
- ? ''
36
- : 'google.protobuf' ),
37
- createEmptyInstance: create,
38
- toProto3Json: $mixin.TimestampMixin .toProto3JsonHelper,
39
- fromProto3Json: $mixin.TimestampMixin .fromProto3JsonHelper)
40
- ..aInt64 (
41
- 1 ,
42
- const $core.bool .fromEnvironment ('protobuf.omit_field_names' )
43
- ? ''
44
- : 'seconds' )
45
- ..a< $core.int > (
46
- 2 ,
47
- const $core.bool .fromEnvironment ('protobuf.omit_field_names' )
48
- ? ''
49
- : 'nanos' ,
50
- $pb.PbFieldType .O3 )
51
- ..hasRequiredFields = false ;
33
+ export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions;
52
34
53
- Timestamp ._() : super ();
35
+ /// A Timestamp represents a point in time independent of any time zone or local
36
+ /// calendar, encoded as a count of seconds and fractions of seconds at
37
+ /// nanosecond resolution. The count is relative to an epoch at UTC midnight on
38
+ /// January 1, 1970, in the proleptic Gregorian calendar which extends the
39
+ /// Gregorian calendar backwards to year one.
40
+ ///
41
+ /// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
42
+ /// second table is needed for interpretation, using a [24-hour linear
43
+ /// smear](https://developers.google.com/time/smear).
44
+ ///
45
+ /// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
46
+ /// restricting to that range, we ensure that we can convert to and from [RFC
47
+ /// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
48
+ ///
49
+ /// # Examples
50
+ ///
51
+ /// Example 1: Compute Timestamp from POSIX `time()` .
52
+ ///
53
+ /// Timestamp timestamp;
54
+ /// timestamp.set_seconds(time(NULL));
55
+ /// timestamp.set_nanos(0);
56
+ ///
57
+ /// Example 2: Compute Timestamp from POSIX `gettimeofday()` .
58
+ ///
59
+ /// struct timeval tv;
60
+ /// gettimeofday(&tv, NULL);
61
+ ///
62
+ /// Timestamp timestamp;
63
+ /// timestamp.set_seconds(tv.tv_sec);
64
+ /// timestamp.set_nanos(tv.tv_usec * 1000);
65
+ ///
66
+ /// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()` .
67
+ ///
68
+ /// FILETIME ft;
69
+ /// GetSystemTimeAsFileTime(&ft);
70
+ /// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
71
+ ///
72
+ /// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
73
+ /// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
74
+ /// Timestamp timestamp;
75
+ /// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
76
+ /// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
77
+ ///
78
+ /// Example 4: Compute Timestamp from Java `System.currentTimeMillis()` .
79
+ ///
80
+ /// long millis = System.currentTimeMillis();
81
+ ///
82
+ /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
83
+ /// .setNanos((int) ((millis % 1000) * 1000000)).build();
84
+ ///
85
+ /// Example 5: Compute Timestamp from Java `Instant.now()` .
86
+ ///
87
+ /// Instant now = Instant.now();
88
+ ///
89
+ /// Timestamp timestamp =
90
+ /// Timestamp.newBuilder().setSeconds(now.getEpochSecond())
91
+ /// .setNanos(now.getNano()).build();
92
+ ///
93
+ /// Example 6: Compute Timestamp from current time in Python.
94
+ ///
95
+ /// timestamp = Timestamp()
96
+ /// timestamp.GetCurrentTime()
97
+ ///
98
+ /// # JSON Mapping
99
+ ///
100
+ /// In JSON format, the Timestamp type is encoded as a string in the
101
+ /// [RFC 3339] (https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
102
+ /// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}] Z"
103
+ /// where {year} is always expressed using four digits while {month}, {day},
104
+ /// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
105
+ /// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
106
+ /// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
107
+ /// is required. A proto3 JSON serializer should always use UTC (as indicated by
108
+ /// "Z") when printing the Timestamp type and a proto3 JSON parser should be
109
+ /// able to accept both UTC and other timezones (as indicated by an offset).
110
+ ///
111
+ /// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
112
+ /// 01:30 UTC on January 15, 2017.
113
+ ///
114
+ /// In JavaScript, one can convert a Date object to this format using the
115
+ /// standard
116
+ /// [toISOString()] (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
117
+ /// method. In Python, a standard `datetime.datetime` object can be converted
118
+ /// to this format using
119
+ /// [`strftime`] (https://docs.python.org/2/library/time.html#time.strftime) with
120
+ /// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
121
+ /// the Joda Time's [`ISODateTimeFormat.dateTime()`] (
122
+ /// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
123
+ /// ) to obtain a formatter capable of generating timestamps in this format.
124
+ class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin {
54
125
factory Timestamp ({
55
126
$fixnum.Int64 ? seconds,
56
127
$core.int ? nanos,
57
128
}) {
58
- final _result = create ();
59
- if (seconds != null ) {
60
- _result.seconds = seconds;
61
- }
62
- if (nanos != null ) {
63
- _result.nanos = nanos;
64
- }
65
- return _result;
129
+ final result = create ();
130
+ if (seconds != null ) result.seconds = seconds;
131
+ if (nanos != null ) result.nanos = nanos;
132
+ return result;
66
133
}
67
- factory Timestamp .fromBuffer ($core.List <$core.int > i,
68
- [$pb.ExtensionRegistry r = $pb.ExtensionRegistry .EMPTY ]) =>
69
- create ()..mergeFromBuffer (i, r);
70
- factory Timestamp .fromJson ($core.String i,
71
- [$pb.ExtensionRegistry r = $pb.ExtensionRegistry .EMPTY ]) =>
72
- create ()..mergeFromJson (i, r);
73
- @$core.Deprecated ('Using this can add significant overhead to your binary. '
74
- 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
75
- 'Will be removed in next major version' )
134
+
135
+ Timestamp ._();
136
+
137
+ factory Timestamp .fromBuffer ($core.List <$core.int > data,
138
+ [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry .EMPTY ]) =>
139
+ create ()..mergeFromBuffer (data, registry);
140
+ factory Timestamp .fromJson ($core.String json, [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry .EMPTY ]) =>
141
+ create ()..mergeFromJson (json, registry);
142
+
143
+ static final $pb.BuilderInfo _i = $pb.BuilderInfo (_omitMessageNames ? '' : 'Timestamp' ,
144
+ package: const $pb.PackageName (_omitMessageNames ? '' : 'google.protobuf' ),
145
+ createEmptyInstance: create,
146
+ toProto3Json: $mixin.TimestampMixin .toProto3JsonHelper,
147
+ fromProto3Json: $mixin.TimestampMixin .fromProto3JsonHelper)
148
+ ..aInt64 (1 , _omitFieldNames ? '' : 'seconds' )
149
+ ..a< $core.int > (2 , _omitFieldNames ? '' : 'nanos' , $pb.PbFieldType .O3 )
150
+ ..hasRequiredFields = false ;
151
+
152
+ @$core.Deprecated ('See https://github.com/google/protobuf.dart/issues/998.' )
76
153
Timestamp clone () => Timestamp ()..mergeFromMessage (this );
77
- @$core.Deprecated ('Using this can add significant overhead to your binary. '
78
- 'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
79
- 'Will be removed in next major version' )
154
+ @$core.Deprecated ('See https://github.com/google/protobuf.dart/issues/998.' )
80
155
Timestamp copyWith (void Function (Timestamp ) updates) =>
81
- super .copyWith ((message) => updates (message as Timestamp ))
82
- as Timestamp ; // ignore: deprecated_member_use
156
+ super .copyWith ((message) => updates (message as Timestamp )) as Timestamp ;
157
+
158
+ @$core.override
83
159
$pb.BuilderInfo get info_ => _i;
160
+
84
161
@$core.pragma ('dart2js:noInline' )
85
162
static Timestamp create () => Timestamp ._();
163
+ @$core.override
86
164
Timestamp createEmptyInstance () => create ();
87
165
static $pb.PbList <Timestamp > createRepeated () => $pb.PbList <Timestamp >();
88
166
@$core.pragma ('dart2js:noInline' )
89
- static Timestamp getDefault () =>
90
- _defaultInstance ?? = $pb.GeneratedMessage .$_defaultFor <Timestamp >(create);
167
+ static Timestamp getDefault () => _defaultInstance ?? = $pb.GeneratedMessage .$_defaultFor <Timestamp >(create);
91
168
static Timestamp ? _defaultInstance;
92
169
170
+ /// Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must
171
+ /// be between -315576000000 and 315576000000 inclusive (which corresponds to
172
+ /// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z).
93
173
@$pb.TagNumber (1 )
94
174
$fixnum.Int64 get seconds => $_getI64 (0 );
95
175
@$pb.TagNumber (1 )
96
- set seconds ($fixnum.Int64 v) {
97
- $_setInt64 (0 , v);
98
- }
99
-
176
+ set seconds ($fixnum.Int64 value) => $_setInt64 (0 , value);
100
177
@$pb.TagNumber (1 )
101
178
$core.bool hasSeconds () => $_has (0 );
102
179
@$pb.TagNumber (1 )
103
- void clearSeconds () => clearField (1 );
180
+ void clearSeconds () => $_clearField (1 );
104
181
182
+ /// Non-negative fractions of a second at nanosecond resolution. This field is
183
+ /// the nanosecond portion of the duration, not an alternative to seconds.
184
+ /// Negative second values with fractions must still have non-negative nanos
185
+ /// values that count forward in time. Must be between 0 and 999,999,999
186
+ /// inclusive.
105
187
@$pb.TagNumber (2 )
106
188
$core.int get nanos => $_getIZ (1 );
107
189
@$pb.TagNumber (2 )
108
- set nanos ($core.int v) {
109
- $_setSignedInt32 (1 , v);
110
- }
111
-
190
+ set nanos ($core.int value) => $_setSignedInt32 (1 , value);
112
191
@$pb.TagNumber (2 )
113
192
$core.bool hasNanos () => $_has (1 );
114
193
@$pb.TagNumber (2 )
115
- void clearNanos () => clearField (2 );
194
+ void clearNanos () => $_clearField (2 );
116
195
117
196
/// Creates a new instance from [dateTime] .
118
197
///
@@ -123,3 +202,6 @@ class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin {
123
202
return result;
124
203
}
125
204
}
205
+
206
+ const $core.bool _omitFieldNames = $core.bool .fromEnvironment ('protobuf.omit_field_names' );
207
+ const $core.bool _omitMessageNames = $core.bool .fromEnvironment ('protobuf.omit_message_names' );
0 commit comments