Time.fromMicroseconds constructor

Time.fromMicroseconds(
  1. int microseconds
)

Creates a Time from the given milliseconds. Behaviour is undefined if microseconds exceeds the total microseconds in a day.

Implementation

factory Time.fromMicroseconds(int microseconds) {
  final total = microseconds;
  final microsecond = microseconds % 1000;
  microseconds ~/= 1000;

  final millisecond = microseconds % 1000;
  microseconds ~/= 1000;

  final second = microseconds % 60;
  microseconds ~/= 60;

  final minute = microseconds % 60;
  microseconds ~/= 60;

  final hour = microseconds % 60;

  return Time(hour, minute, second, millisecond, microsecond).._inMicroseconds = total;
}