struct Zone
pub struct Zone
Conforms to Equatable.
A time zone: UTC, a fixed offset, or a zone of the database — its
transitions and the rule for the years beyond them (TZif, RFC 8536; a POSIX TZ string).
Zone.utc, Zone.fixed(offset), Zone.load("Europe/Berlin") from the system's database,
Zone.local() the system's own, Zone.fromTzif(name, bytes) and Zone.fromPosix(name, tz)
for data of one's own (a tzdata package's). Two zones are equal by name and kind.
Constants
pub static let utc: Zone = Zone { label = "UTC", off = 0, rules = null }
Methods
pub static fn fixed(offset: Duration): Zone throws TimeError
Returns the zone offset east of UTC — west for a negative one.
Errors
Throws TimeError unless the offset is whole minutes under 24 hours, as RFC 3339 writes
an offset.
pub static fn load(name: string): Zone throws TimeError
Loads a zone of the system's database, /usr/share/zoneinfo or TZDIR, by its IANA name
(Europe/Berlin). UTC, Etc/UTC and Z return Zone.utc without the database.
Errors
Throws TimeError with kind NoZoneData where the system has no database (Windows),
NoSuchZone for a name that is no zone name or that the database does not have, and
Invalid for a file that is no TZif.
pub static fn fromTzif(name: string, bytes: Slice<uint8>): Zone throws TimeError
Returns a zone from the bytes of a TZif file (RFC 8536, versions 1 to 4): the transitions, the local time types, and the footer's rule for the years beyond.
Errors
Throws TimeError for bytes that are no valid TZif file.
pub static fn fromPosix(name: string, tz: string): Zone throws TimeError
Returns a zone from a POSIX TZ string (RFC 8536 §3.3.1): CET-1CEST,M3.5.0,M10.5.0/3,
EST5EDT, <+0330>-3:30.
Errors
Throws TimeError for a string that is no valid TZ string.
pub static fn local(): Zone
Returns the system's own zone: TZ where set (a name of the database, or a POSIX string),
else /etc/localtime, else UTC — on Windows, which has no database, UTC.
pub fn name(): string
pub fn isFixed(): bool
Returns whether the zone is one offset for all time.
pub fn offset(): Duration
Returns the offset of a fixed zone; for a zone of the database, its offset now.
pub fn offsetAt(at: Instant): Duration
Returns the offset east of UTC at the moment at.
pub fn infoAt(at: Instant): ZoneInfo
Returns the offset, whether daylight time is in force, and the abbreviation at the moment
at.
fn equals(o: Zone): bool