package core:time/timezone
Overview
Timezone lookup.
Index
Constants (3)
Variables (0)
This section is empty.
Procedures (16)
datetime_… (3)
- dst
- dst_unsafe
- load_tzif_file
parse_… (3)
- rrule_destroy
- shortname
- shortname_unsafe
Procedure Groups (0)
This section is empty.
Types
Sun_Shift ¶
Sun_Shift :: enum u8 { Standard = 0, DST = 1, }
TZif_Version ¶
TZif_Version :: enum u8 { V1 = 0, V2 = '2', V3 = '3', V4 = '4', }
Constants
BIG_BANG_ISH ¶
BIG_BANG_ISH :: -0x800000000000000
TWO_AM ¶
TWO_AM :: 2 * 60 * 60
Variables
This section is empty.
Procedures
datetime_to_str ¶
datetime_to_str :: proc(dt: datetime.DateTime, allocator := context.allocator) -> string {…}
datetime_to_tz ¶
datetime_to_tz :: proc( dt: datetime.DateTime, tz: ^datetime.TZ_Region, ) -> (out: datetime.DateTime, success: bool) #optional_ok {…}
Converts a datetime on one timezone to another timezone
Inputs:
- dt The input datetime
- tz The timezone to convert to
NOTE: tz will be referenced in the result datetime, so it must stay alive/allocated as long as it is used Returns:
- out: The converted datetime
- success:
falseif the datetime was invalid
dst ¶
Checks DST for a given date.
Inputs:
- dt The input datetime
Returns:
- is_dst returns
trueif dt is in daylight savings time,falseif not - success returns
falseif the passed datetime is invalid
dst_unsafe ¶
Checks DST for a given date.
WARNING: This is unsafe because it doesn't check if your datetime is valid or if your region contains a valid record.
Inputs:
- dt The input datetime
Returns:
- is_dst returns
trueif dt is in daylight savings time,falseif not
load_tzif_file ¶
load_tzif_file :: proc( filename: string, region_name: string, allocator := context.allocator, ) -> (out: ^datetime.TZ_Region, ok: bool) {…}
parse_posix_rrule ¶
parse_posix_rrule :: proc(str: string) -> (out: datetime.TZ_Transition_Date, idx: int, ok: bool) {…}
parse_posix_tz ¶
parse_posix_tz :: proc( posix_tz: string, allocator := context.allocator, ) -> (out: datetime.TZ_RRule, ok: bool) {…}
parse_tzif ¶
parse_tzif :: proc( _buffer: []u8, region_name: string, allocator := context.allocator, ) -> (out: ^datetime.TZ_Region, ok: bool) {…}
region_destroy ¶
region_destroy :: proc(region: ^datetime.TZ_Region, allocator := context.allocator) {…}
region_load ¶
region_load :: proc( reg: string, allocator := context.allocator, ) -> (out_reg: ^datetime.TZ_Region, ok: bool) {…}
region_load_from_buffer ¶
region_load_from_buffer :: proc( buffer: []u8, reg: string, allocator := context.allocator, ) -> (out_reg: ^datetime.TZ_Region, ok: bool) {…}
region_load_from_file ¶
region_load_from_file :: proc( file_path, reg: string, allocator := context.allocator, ) -> (out_reg: ^datetime.TZ_Region, ok: bool) {…}
rrule_destroy ¶
rrule_destroy :: proc(rrule: datetime.TZ_RRule, allocator := context.allocator) {…}
shortname ¶
Gets the timezone abbreviation/shortname for a given date. (ex: "PDT")
Inputs:
- dt The datetime containing the date, time, and timezone pointer for the lookup
NOTE: The lifetime of name matches the timezone it was pulled from. Returns:
- name: The timezone abbreviation
- success: returns
falseif the passed datetime is invalid
shortname_unsafe ¶
Gets the timezone abbreviation/shortname for a given date. (ex: "PDT")
WARNING: This is unsafe because it doesn't check if your datetime is valid or if your region contains a valid record.
Inputs:
- dt The input datetime
NOTE: The lifetime of name matches the timezone it was pulled from. Returns:
- name: The timezone abbreviation
Procedure Groups
This section is empty.
Source Files
- tz_os.odin
- tzdate.odin
- tzif.odin
- (hidden platform specific files)
Generation Information
Generated with odin version dev-2026-10 (vendor "odin") Windows_amd64 @ 2026-10-06 16:45:10.733986900 +0000 UTC