mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
swap datetime_to_str to aprintf
This commit is contained in:
@@ -288,16 +288,14 @@ dst_unsafe :: proc(dt: datetime.DateTime) -> bool {
|
|||||||
return record.dst
|
return record.dst
|
||||||
}
|
}
|
||||||
|
|
||||||
datetime_to_str :: proc(dt: datetime.DateTime, allocator := context.temp_allocator) -> string {
|
datetime_to_str :: proc(dt: datetime.DateTime, allocator := context.allocator) -> string {
|
||||||
context.temp_allocator = allocator
|
|
||||||
|
|
||||||
if dt.tz == nil {
|
if dt.tz == nil {
|
||||||
_, ok := time.datetime_to_time(dt)
|
_, ok := time.datetime_to_time(dt)
|
||||||
if !ok {
|
if !ok {
|
||||||
return ""
|
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 {
|
} else {
|
||||||
tm, ok := time.datetime_to_time(dt)
|
tm, ok := time.datetime_to_time(dt)
|
||||||
@@ -317,6 +315,6 @@ datetime_to_str :: proc(dt: datetime.DateTime, allocator := context.temp_allocat
|
|||||||
hour -= 12
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user