package core:time/timezone

⌘K
Ctrl+K
or
/

    Types

    Leapsecond_Record ¶

    Leapsecond_Record :: struct #packed {
    	occur: i64be,
    	corr:  i32be,
    }

    Local_Time_Type ¶

    Local_Time_Type :: struct #packed {
    	utoff: i32be,
    	dst:   Sun_Shift,
    	idx:   u8,
    }

    Sun_Shift ¶

    Sun_Shift :: enum u8 {
    	Standard = 0, 
    	DST      = 1, 
    }

    TZif_Header ¶

    TZif_Header :: struct #packed {
    	magic:    u32be,
    	version:  TZif_Version,
    	reserved: [15]u8,
    	isutcnt:  u32be,
    	isstdcnt: u32be,
    	leapcnt:  u32be,
    	timecnt:  u32be,
    	typecnt:  u32be,
    	charcnt:  u32be,
    }

    TZif_Version ¶

    TZif_Version :: enum u8 {
    	V1 = 0, 
    	V2 = 50, 
    	V3 = 51, 
    	V4 = 52, 
    }

    Constants

    BIG_BANG_ISH ¶

    BIG_BANG_ISH :: -0x800000000000000

    TWO_AM ¶

    TWO_AM :: 2 * 60 * 60

    TZIF_MAGIC ¶

    TZIF_MAGIC :: u32be(0x545A6966)
     

    'TZif'

    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: false if the datetime was invalid

    datetime_to_utc ¶

    datetime_to_utc :: proc(dt: datetime.DateTime) -> (out: datetime.DateTime, success: bool) #optional_ok {…}

    dst ¶

    dst :: proc(dt: datetime.DateTime) -> (is_dst: bool, success: bool) #optional_ok {…}
     

    Checks DST for a given date.

    Inputs:
    dt: The input datetime

    Returns:
    is_dst: returns true if dt is in daylight savings time, false if not success: returns false if the passed datetime is invalid

    dst_unsafe ¶

    dst_unsafe :: proc(dt: datetime.DateTime) -> bool {…}
     

    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 true if dt is in daylight savings time, false if 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 ¶

    shortname :: proc(dt: datetime.DateTime) -> (name: string, success: bool) #optional_ok {…}
     

    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 false if the passed datetime is invalid

    shortname_unsafe ¶

    shortname_unsafe :: proc(dt: datetime.DateTime) -> string {…}
     

    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

    Generation Information

    Generated with odin version dev-2024-11 (vendor "odin") Windows_amd64 @ 2024-11-16 21:10:10.894998700 +0000 UTC