reinterpretAs method

Hora reinterpretAs(
  1. HoraTimezone targetTimezone
)

Reinterprets current wall-clock as belonging to targetTimezone.

This changes the underlying instant.

Implementation

Hora reinterpretAs(HoraTimezone targetTimezone) {
  final wallMicros = _wallClockUtcDateTime.microsecondsSinceEpoch;
  final reinterpretedMicros =
      wallMicros - targetTimezone.offset.inMicroseconds;
  return Hora.fromTimestamp(
    reinterpretedMicros,
    locale: instantUtc.locale,
    utc: true,
    unit: UnixTimestampUnit.microseconds,
  );
}