Offset.time constructor

Offset.time(
  1. Time time
)

Converts the given Time to an offset, with fractional seconds truncated.

time: The Time to convert

Returns: An offset for the same time as the given time span.

RangeError: The given time span falls outside the range of +/- 18 hours.

Implementation

factory Offset.time(Time time) {
  int seconds = time.totalSeconds.floor();
  Preconditions.checkArgumentRange('time', seconds, _minSeconds, _maxSeconds);
  return Offset(seconds);
}