Timestamp.fromMicros constructor
Timestamp.fromMicros(
- int microseconds
Creates a new timestamp from the given number of microseconds.
final documentRef = firestore.doc('col/doc');
documentRef.set({ 'startTime': Timestamp.fromMicros(42) });
microseconds
: Number of microseconds since Unix epoch 1970-01-01T00:00:00Z.
Returns a new Timestamp representing the same point in time as the given number of microseconds.
Implementation
factory Timestamp.fromMicros(int microseconds) {
final seconds = (microseconds / 1000 / 1000).floor();
final nanos = (microseconds - seconds * 1000 * 1000) * _usToNanos;
return Timestamp(seconds: seconds, nanoseconds: nanos);
}