tz
37 items · generated by scribe fromstdlib/tz.fd· synced 2026-11-15
Contents
- TzWhen (struct)
- TzHist (struct)
- Tz (struct)
- tz_names (function)
- tz_find (function)
- tz_known (function)
- tz_is_dst (function)
- tz_offset (function)
- tz_abbr (function)
- tz_offset_str (function)
- tz_to_local (function)
- tz_from_local (function)
- tz_tzif_ok (function)
- tz_from_tzif (function)
- tz_load (function)
- tz_from_posix (function)
- tz_format (function)
- tz_to_iso (function)
- tz_convert (function)
TzWhen
When a change happens: in month, the week-th weekday (0 Sunday .. 6 Saturday; week 5 = the last one), at secs seconds after midnight of the local clock (utc = false) or of UTC (utc = true). month 0 is a day of the year instead (the POSIX Julian forms), held in weekday: with week 1 it is “Jn”, n from 1 to 365 with February 29 never counted (J60 is always March 1); with week 0 it is “n”, n from 0 to 365 counting February 29 (59 is February 29 in a leap year).
pub struct TzWhen {Fields:
| Name | Type |
|---|---|
month | i64 |
week | i64 |
weekday | i64 |
secs | i64 |
utc | bool |
Defined at line 41
TzHist
A zone’s past (from a TZif file): the UTC moments the clock changed (at, ascending) and the local time type from each one on (kind, an index into off/dst/abbr); before the first, type first. Empty for a zone of the built-in table.
pub struct TzHist {Fields:
| Name | Type |
|---|---|
at | Vec<i64> |
kind | Vec<i64> |
off | Vec<i64> |
dst | Vec<i64> |
abbr | Vec<str> |
first | i64 |
has_rule | bool |
Defined at line 53
Tz
A time zone: its name, standard offset (seconds east of UTC), and DST: whether it has one, how far it moves the clock, when it starts and ends; and, for a zone read from the database, its past (hist).
pub struct Tz {Fields:
| Name | Type |
|---|---|
name | str |
std_off | i64 |
std_abbr | str |
has_dst | bool |
dst_save | i64 |
dst_abbr | str |
start | TzWhen |
end | TzWhen |
hist | TzHist |
Defined at line 72
tz_names
The zones this module knows, by IANA name. Unknown names give UTC.
pub fn tz_names() -> Vec<str> {Returns: Vec<str>
Defined at line 112
tz_find
The zone of that IANA name (“Europe/Paris”), “UTC”, or a fixed offset written “+05:30” / “-08:00”; anything else is UTC.
pub fn tz_find(name: str) -> Tz {Parameters:
name:str
Returns: Tz
Defined at line 198
tz_known
Is name one of the zones this module knows?
pub fn tz_known(name: str) -> bool {Parameters:
name:str
Returns: bool
Defined at line 221
tz_is_dst
Is daylight time in force at t (UTC seconds)?
pub fn tz_is_dst(z: Tz, t: LogicalTime) -> bool {Parameters:
z:Tzt:LogicalTime
Returns: bool
Defined at line 305
tz_offset
The zone’s offset from UTC at t, in seconds east.
pub fn tz_offset(z: Tz, t: LogicalTime) -> i64 {Parameters:
z:Tzt:LogicalTime
Returns: i64
Defined at line 325
tz_abbr
The abbreviation in force at t (EST or EDT, CET or CEST …).
pub fn tz_abbr(z: Tz, t: LogicalTime) -> str {Parameters:
z:Tzt:LogicalTime
Returns: str
Defined at line 337
tz_offset_str
An offset as “+HH:MM” or “-HH:MM”.
pub fn tz_offset_str(off: i64) -> str {Parameters:
off:i64
Returns: str
Defined at line 349
tz_to_local
The wall-clock time in zone z at the UTC moment t, as a LogicalTime whose fields (time_get_hour …) read as that local clock.
pub fn tz_to_local(t: LogicalTime, z: Tz) -> LogicalTime {Parameters:
t:LogicalTimez:Tz
Returns: LogicalTime
Defined at line 371
tz_from_local
The UTC moment at which zone z’s clock shows local (built with time_new). A local time skipped in spring is read after the gap; one repeated in autumn is its first occurrence.
pub fn tz_from_local(local: LogicalTime, z: Tz) -> LogicalTime {Parameters:
local:LogicalTimez:Tz
Returns: LogicalTime
Defined at line 378
tz_tzif_ok
Is b a TZif file this module reads (versions 1 to 4)?
pub fn tz_tzif_ok(b: Vec<i64>) -> bool {Parameters:
b:Vec<i64>
Returns: bool
Defined at line 429
tz_from_tzif
The zone name from the bytes of its TZif file. Anything malformed gives UTC (with that name); tz_tzif_ok says whether bytes are TZif.
pub fn tz_from_tzif(name: str, b: Vec<i64>) -> Tz {Parameters:
name:strb:Vec<i64>
Returns: Tz
Defined at line 450
tz_load
The zone name (“America/New_York”) with its whole past, from the system’s time zone database; the built-in table’s zone where there is no database (Windows) or no such file.
pub fn tz_load(name: str) -> Tz {Parameters:
name:str
Returns: Tz
Defined at line 563
tz_from_posix
The zone a POSIX TZ string describes (“CET-1CEST,M3.5.0,M10.5.0/3”, ”<+0530>-5:30”, ”<+0330>-3:30<+0430>,J79/24,J263/24”); a zone whose name is "" when it cannot be read. POSIX offsets count west, so “EST5” is five hours behind UTC.
pub fn tz_from_posix(name: str, s: str) -> Tz {Parameters:
name:strs:str
Returns: Tz
Defined at line 720
tz_format
dt_format of the local time in z, plus %Z (abbreviation) and %z (offset, “+HH:MM”).
pub fn tz_format(t: LogicalTime, z: Tz, fmt: str) -> str {Parameters:
t:LogicalTimez:Tzfmt:str
Returns: str
Defined at line 771
tz_to_iso
ISO 8601 with the zone’s offset: “2026-07-04T12:00:00-04:00”.
pub fn tz_to_iso(t: LogicalTime, z: Tz) -> str {Parameters:
t:LogicalTimez:Tz
Returns: str
Defined at line 779
tz_convert
The same moment shown in another zone: wall clock of to.
pub fn tz_convert(local: LogicalTime, from: Tz, to: Tz) -> LogicalTime {Parameters:
local:LogicalTimefrom:Tzto:Tz
Returns: LogicalTime
Defined at line 784
Generated by scribe, the Fides documentation generator