aboutsummaryrefslogtreecommitdiff
path: root/distamp.ha
diff options
context:
space:
mode:
Diffstat (limited to 'distamp.ha')
-rw-r--r--distamp.ha11
1 files changed, 7 insertions, 4 deletions
diff --git a/distamp.ha b/distamp.ha
index 215eb07..72a71b1 100644
--- a/distamp.ha
+++ b/distamp.ha
@@ -76,10 +76,13 @@ fn printdistamp(i: i64) void = {
};
fn abs(s: str) (i64 | date::error) = {
- // 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")!)?;
+ let v = date::newvirtual();
+ v.vloc = chrono::LOCAL;
+ v.zoff = date::zflag::LAP_EARLY | date::zflag::GAP_END;
+ date::parse(&v, "%Y-%m-%d %T", s)!;
+ v.nanosecond = 0;
+ let d = date::realize(v, chrono::LOCAL)!;
+ //date::format(os::stderr, "%Y-%m-%d %T %L", &d)!;
return time::unix(*(&d: *time::instant));
};