hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 14f7c62220a0e8e9b3a50a334bb5501671bab28a
parent 603b0ee10143a9bd5abfe189f05264ba26d638ee
Author: Byron Torres <b@torresjrjr.com>
Date:   Tue,  1 Feb 2022 22:41:21 +0000

make new() param 'loc' just chrono::locality

Signed-off-by: Byron Torres <b@torresjrjr.com>

Diffstat:
Mdatetime/datetime.ha | 8+++-----
Mtime/chrono/chronology.ha | 5-----
2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/datetime/datetime.ha b/datetime/datetime.ha @@ -89,11 +89,9 @@ fn init() datetime = datetime { // TODO: fix calls with `years <= -4715`. https://todo.sr.ht/~sircmpwn/hare/565 // export fn new( - // TODO: should this be `nullable *chrono::timezone`? - // would interface better with other code, i presume. - loc: (*chrono::timezone | void), + loc: chrono::locality, - // normal offset (offset from normal timezone (UTC0, TAI0, etc.)) + // normal offset (offset from normal timezone (UTC, TAI, etc.)) // // TODO: type `(time::duration | first | last)`? or // TODO: type `(time::duration | enum { FIRST, LAST } )`? @@ -132,7 +130,7 @@ export fn new( let m = chrono::moment { date = calc_epochal_from_ymd(year, month, day)?, time = calc_time_from_hmsn(hour, min, sec, nsec)?, - loc = if (loc is void) chrono::LOCAL else loc: *chrono::timezone, + loc = loc, zone = chrono::zone { ... }, }; diff --git a/time/chrono/chronology.ha b/time/chrono/chronology.ha @@ -13,11 +13,6 @@ export type moment = struct { time: time::duration, // The timezone used for interpreting a moment's date and time - // - // TODO: make locality nullable? would make moment "{ ... }" initable - // without a "new" function, though all functions would have to default - // to a particular locality, which might be bad design considering we - // don't just support UTC. loc: locality, // The current [[zone]] this moment observes