Timestamp.fromMillisecondsSinceEpoch constructor

Timestamp.fromMillisecondsSinceEpoch(
  1. int millisecondsSinceEpoch
)

Constructs a new Timestamp instance with the given millisecondsSinceEpoch.

Implementation

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