aboutsummaryrefslogtreecommitdiff
path: root/core/time/timezone/tz_os.odin
blob: fae4980c3b8840ce7dca8529ce9488f0eba87f46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#+build !freestanding
#+build !js
package timezone

import "core:os"
import "core:time/datetime"

load_tzif_file :: proc(filename: string, region_name: string, allocator := context.allocator) -> (out: ^datetime.TZ_Region, ok: bool) {
	tzif_data, tzif_err := os.read_entire_file(filename, allocator)
	if tzif_err != nil {
		return nil, false
	}
	defer delete(tzif_data, allocator)
	return parse_tzif(tzif_data, region_name, allocator)
}

region_load_from_file :: proc(file_path, reg: string, allocator := context.allocator) ->  (out_reg: ^datetime.TZ_Region, ok: bool) {
	return load_tzif_file(file_path, reg, allocator)
}