aboutsummaryrefslogtreecommitdiff
path: root/distamp.ha
diff options
context:
space:
mode:
authorJulian Hurst <ark@mansus.space>2024-10-16 02:31:19 +0200
committerJulian Hurst <ark@mansus.space>2024-10-16 02:31:22 +0200
commitd5c1a74dd5af1398521b2e2b58d55c9277928ab0 (patch)
tree030665e76c5c440ce11bfcba41651f0f24dd63f3 /distamp.ha
parent299c9cd5a4696bab85291dd61520e65bac8de7a3 (diff)
downloaddistamp-d5c1a74dd5af1398521b2e2b58d55c9277928ab0.tar.gz
Fix locality
Locality in from_str seems broken, it needs to be specified twice with %L in the layout and as a parameter.
Diffstat (limited to 'distamp.ha')
-rw-r--r--distamp.ha5
1 files changed, 4 insertions, 1 deletions
diff --git a/distamp.ha b/distamp.ha
index 1609419..fc5cf28 100644
--- a/distamp.ha
+++ b/distamp.ha
@@ -76,7 +76,10 @@ fn printdistamp(i: i64) void = {
};
fn abs(s: str) (i64 | date::error) = {
- let d = date::from_str("%Y-%m-%d %H:%M:%S", s, chrono::LOCAL)?;
+ // for some reason locality needs to be specified twice (hare stdlib bug?)
+ const stz = strings::concat(s, " Europe/Paris");
+ defer free(stz);
+ let d = date::from_str("%Y-%m-%d %T %L", stz, chrono::tz("Europe/Paris")!)?;
return time::unix(*(&d: *time::instant));
};