timestamp.pb.dart 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. ///
  65. /// Example 5: Compute Timestamp from Java `Instant.now()`.
  66. ///
  67. /// Instant now = Instant.now();
  68. ///
  69. /// Timestamp timestamp =
  70. /// Timestamp.newBuilder().setSeconds(now.getEpochSecond())
  71. /// .setNanos(now.getNano()).build();
  72. ///
  73. ///
  74. /// Example 6: Compute Timestamp from current time in Python.
  75. ///
  76. /// timestamp = Timestamp()
  77. /// timestamp.GetCurrentTime()
  78. ///
  79. /// # JSON Mapping
  80. ///
  81. /// In JSON format, the Timestamp type is encoded as a string in the
  82. /// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
  83. /// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
  84. /// where {year} is always expressed using four digits while {month}, {day},
  85. /// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
  86. /// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
  87. /// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
  88. /// is required. A proto3 JSON serializer should always use UTC (as indicated by
  89. /// "Z") when printing the Timestamp type and a proto3 JSON parser should be
  90. /// able to accept both UTC and other timezones (as indicated by an offset).
  91. ///
  92. /// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
  93. /// 01:30 UTC on January 15, 2017.
  94. ///
  95. /// In JavaScript, one can convert a Date object to this format using the
  96. /// standard
  97. /// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
  98. /// method. In Python, a standard `datetime.datetime` object can be converted
  99. /// to this format using
  100. /// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
  101. /// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
  102. /// the Joda Time's [`ISODateTimeFormat.dateTime()`](
  103. /// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
  104. /// ) to obtain a formatter capable of generating timestamps in this format.
  105. class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin {
  106. factory Timestamp({
  107. $fixnum.Int64? seconds,
  108. $core.int? nanos,
  109. }) {
  110. final $result = create();
  111. if (seconds != null) {
  112. $result.seconds = seconds;
  113. }
  114. if (nanos != null) {
  115. $result.nanos = nanos;
  116. }
  117. return $result;
  118. }
  119. Timestamp._() : super();
  120. factory Timestamp.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
  121. factory Timestamp.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
  122. 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)
  123. ..aInt64(1, _omitFieldNames ? '' : 'seconds')
  124. ..a<$core.int>(2, _omitFieldNames ? '' : 'nanos', $pb.PbFieldType.O3)
  125. ..hasRequiredFields = false
  126. ;
  127. @$core.Deprecated(
  128. 'Using this can add significant overhead to your binary. '
  129. 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
  130. 'Will be removed in next major version')
  131. Timestamp clone() => Timestamp()..mergeFromMessage(this);
  132. @$core.Deprecated(
  133. 'Using this can add significant overhead to your binary. '
  134. 'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
  135. 'Will be removed in next major version')
  136. Timestamp copyWith(void Function(Timestamp) updates) => super.copyWith((message) => updates(message as Timestamp)) as Timestamp;
  137. $pb.BuilderInfo get info_ => _i;
  138. @$core.pragma('dart2js:noInline')
  139. static Timestamp create() => Timestamp._();
  140. Timestamp createEmptyInstance() => create();
  141. static $pb.PbList<Timestamp> createRepeated() => $pb.PbList<Timestamp>();
  142. @$core.pragma('dart2js:noInline')
  143. static Timestamp getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Timestamp>(create);
  144. static Timestamp? _defaultInstance;
  145. /// Represents seconds of UTC time since Unix epoch
  146. /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
  147. /// 9999-12-31T23:59:59Z inclusive.
  148. @$pb.TagNumber(1)
  149. $fixnum.Int64 get seconds => $_getI64(0);
  150. @$pb.TagNumber(1)
  151. set seconds($fixnum.Int64 v) { $_setInt64(0, v); }
  152. @$pb.TagNumber(1)
  153. $core.bool hasSeconds() => $_has(0);
  154. @$pb.TagNumber(1)
  155. void clearSeconds() => clearField(1);
  156. /// Non-negative fractions of a second at nanosecond resolution. Negative
  157. /// second values with fractions must still have non-negative nanos values
  158. /// that count forward in time. Must be from 0 to 999,999,999
  159. /// inclusive.
  160. @$pb.TagNumber(2)
  161. $core.int get nanos => $_getIZ(1);
  162. @$pb.TagNumber(2)
  163. set nanos($core.int v) { $_setSignedInt32(1, v); }
  164. @$pb.TagNumber(2)
  165. $core.bool hasNanos() => $_has(1);
  166. @$pb.TagNumber(2)
  167. void clearNanos() => clearField(2);
  168. /// Creates a new instance from [dateTime].
  169. ///
  170. /// Time zone information will not be preserved.
  171. static Timestamp fromDateTime($core.DateTime dateTime) {
  172. final result = create();
  173. $mixin.TimestampMixin.setFromDateTime(result, dateTime);
  174. return result;
  175. }
  176. }
  177. const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
  178. const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names');