timestamp.pb.dart 8.0 KB

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