Timestamp constructor

Timestamp(
  1. int seconds,
  2. int nanoseconds
)

seconds is the number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.

nanoseconds is the non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanoseconds values that count forward in time. Must be from 0 to 999,999,999 inclusive.

Implementation

Timestamp(this.seconds, this.nanoseconds) {
  if (seconds < -62135596800 || seconds > 253402300799) {
    throw ArgumentError('invalid seconds part ${toDateTime(isUtc: true)}');
  }
  if (nanoseconds < 0 || nanoseconds > 999999999) {
    throw ArgumentError(
        'invalid nanoseconds part ${toDateTime(isUtc: true)}');
  }
}