toTimestamp method

Timestamp toTimestamp()

This UTC DateTime as a Timestamp.

Implementation

Timestamp toTimestamp() {
  if (!isUtc) {
    throw StateError('DateTime must be in UTC');
  }
  return Timestamp(
    seconds: microsecondsSinceEpoch ~/ 1_000_000,
    nanos: microsecondsSinceEpoch % 1_000_000 * 1000,
  );
}