hare

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

conv.ha (359B)


      1 // SPDX-License-Identifier: MPL-2.0
      2 // (c) Hare authors <https://harelang.org>
      3 
      4 // Converts a given [[instant]] to a Unix timestamp.
      5 // Note, nanosecond information is lost during conversion.
      6 export fn unix(i: instant) i64 = i.sec;
      7 
      8 // Converts a given Unix timestamp to an [[instant]].
      9 export fn from_unix(u: i64) instant = instant {
     10 	sec = u,
     11 	nsec = 0,
     12 };