aboutsummaryrefslogtreecommitdiff
path: root/core/time
diff options
context:
space:
mode:
authorColin Davidson <colrdavidson@gmail.com>2024-10-10 10:17:02 -0700
committerColin Davidson <colrdavidson@gmail.com>2024-10-10 10:17:02 -0700
commit19c2b4d54f7ee5362c0819bd9af94df5e4b2e82c (patch)
tree554fcf0183425bb780be239e19cc1f680ac25c60 /core/time
parentfcaa3abe4781fd88ec62856af43a8cf28ac27bd9 (diff)
swap datetime_to_str to aprintf
Diffstat (limited to 'core/time')
-rw-r--r--core/time/timezone/tzdate.odin8
1 files changed, 3 insertions, 5 deletions
diff --git a/core/time/timezone/tzdate.odin b/core/time/timezone/tzdate.odin
index c96f8aab3..c321e8294 100644
--- a/core/time/timezone/tzdate.odin
+++ b/core/time/timezone/tzdate.odin
@@ -288,16 +288,14 @@ dst_unsafe :: proc(dt: datetime.DateTime) -> bool {
return record.dst
}
-datetime_to_str :: proc(dt: datetime.DateTime, allocator := context.temp_allocator) -> string {
- context.temp_allocator = allocator
-
+datetime_to_str :: proc(dt: datetime.DateTime, allocator := context.allocator) -> string {
if dt.tz == nil {
_, ok := time.datetime_to_time(dt)
if !ok {
return ""
}
- return fmt.tprintf("%02d-%02d-%04d @ %02d:%02d:%02d UTC", dt.month, dt.day, dt.year, dt.hour, dt.minute, dt.second)
+ return fmt.aprintf("%02d-%02d-%04d @ %02d:%02d:%02d UTC", dt.month, dt.day, dt.year, dt.hour, dt.minute, dt.second, allocator = allocator)
} else {
tm, ok := time.datetime_to_time(dt)
@@ -317,6 +315,6 @@ datetime_to_str :: proc(dt: datetime.DateTime, allocator := context.temp_allocat
hour -= 12
}
- return fmt.tprintf("%02d-%02d-%04d @ %02d:%02d:%02d %s %s", dt.month, dt.day, dt.year, hour, dt.minute, dt.second, am_pm_str, record.shortname)
+ return fmt.aprintf("%02d-%02d-%04d @ %02d:%02d:%02d %s %s", dt.month, dt.day, dt.year, hour, dt.minute, dt.second, am_pm_str, record.shortname, allocator = allocator)
}
}