Timestamp.fromMicrosecondsSinceEpoch constructor

Timestamp.fromMicrosecondsSinceEpoch(
  1. int microsecondsSinceEpoch
)

Constructs a new Timestamp instance with the given microsecondsSinceEpoch.

Implementation

factory Timestamp.fromMicrosecondsSinceEpoch(int microsecondsSinceEpoch) {
  final seconds = (microsecondsSinceEpoch / 1000000).floor();
  final nanoseconds = (microsecondsSinceEpoch % 1000000) * 1000;
  return Timestamp(seconds, nanoseconds);
}