aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA1029384756 <hayden.gray104@gmail.com>2025-12-15 12:36:54 -0500
committerA1029384756 <hayden.gray104@gmail.com>2025-12-15 12:36:54 -0500
commit916ec44ad17e0661e05b12bbc085250fd70d9b82 (patch)
tree72f6cfe015f844ef27e28e4e1a066b4f688475c4
parent7b635c031f8e795bd36d70d9559909f3ad6f8c8a (diff)
[tz_unix] add lookup for TZDIR environment variable
-rw-r--r--core/time/timezone/tz_unix.odin12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/time/timezone/tz_unix.odin b/core/time/timezone/tz_unix.odin
index d940e47be..542e5c4f2 100644
--- a/core/time/timezone/tz_unix.odin
+++ b/core/time/timezone/tz_unix.odin
@@ -81,6 +81,18 @@ _region_load :: proc(_reg_str: string, allocator := context.allocator) -> (out_r
}
defer if _reg_str == "local" { delete(reg_str, allocator) }
+ tzdir_str, tzdir_ok := os.lookup_env("TZDIR", allocator)
+ defer if tzdir_ok { delete(tzdir_str, allocator) }
+
+ if tzdir_ok {
+ region_path := filepath.join({tzdir_str, reg_str}, allocator)
+ defer delete(region_path, allocator)
+
+ if tz_reg, ok := load_tzif_file(region_path, reg_str, allocator); ok {
+ return tz_reg, true
+ }
+ }
+
db_paths := []string{"/usr/share/zoneinfo", "/share/zoneinfo", "/etc/zoneinfo"}
for db_path in db_paths {
region_path := filepath.join({db_path, reg_str}, allocator)