hare

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

timezone.ha (467B)


      1 // License: MPL-2.0
      2 // (c) 2021-2022 Byron Torres <b@torresjrjr.com>
      3 // (c) 2022 Drew DeVault <sir@cmpwn.com>
      4 use time;
      5 use time::chrono;
      6 
      7 // Creates an equivalent [[datetime]] with a different
      8 // [[time::chrono::locality]].
      9 //
     10 // The [[time::chrono::discontinuity]] rules from [[time::chrono::in]] apply here.
     11 export fn in(loc: chrono::locality, dt: datetime) (datetime | chrono::discontinuity) = {
     12 	return from_moment(chrono::in(loc, *(&dt: *chrono::moment))?);
     13 };