ref: cdc1fad5a1a7e95a7fe7e70f06365c3c47f585b1
parent: c9a1279887d39324b347d42e06114950429fb4c6
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Aug 29 13:05:13 EDT 2014
Add 'tozone' converter for dates.
--- a/lib/date/date.myr
+++ b/lib/date/date.myr
@@ -6,7 +6,8 @@
/* useful constructors */
const utcnow : (-> instant)
const now : (tz : byte[:] -> instant)
- const mkdate : (tm : std.time, zone : byte[:] -> instant)
+ const tozone : (d : instant, zone : byte[:] -> instant)
+ const mkdate : (tm : std.time, zone : byte[:] -> instant)
const localoff : (tm : std.time -> diff)
const tzoff : (tzname : byte[:], tm : std.time -> diff)
@@ -33,6 +34,10 @@
tm = std.now()
-> mkdate(tm, tz)
+}
+
+const tozone = {d, tz
+ -> mkdate(d.actual, tz)
}
const mkdate = {tm, tz