hare

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

duration.ha (360B)


      1 // License: MPL-2.0
      2 // (c) 2023 Byron Torres <b@torresjrjr.com>
      3 use time;
      4 
      5 // Adds a [[time::duration]] to a [[datetime]] with [[time::add]].
      6 //
      7 // See [[reckon]] for a chronology-wise arithmetic operation which uses
      8 // [[period]].
      9 export fn add(a: datetime, d: time::duration) datetime = {
     10 	return from_instant(a.loc, time::add(*(&a: *time::instant), d));
     11 };