hare

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

commit c7450624ca64ee8db35f39525b549db344b61623
parent f10ac698195c0ba1d73dcb6b84ae9c43944f1abb
Author: Byron Torres <b@torresjrjr.com>
Date:   Fri,  4 Feb 2022 11:00:07 +0000

new datetime::to_instant()

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

Diffstat:
Mdatetime/datetime.ha | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/datetime/datetime.ha b/datetime/datetime.ha @@ -198,6 +198,11 @@ export fn from_instant(i: time::instant, loc: chrono::locality) datetime = { return from_moment(chrono::from_instant(i, loc)); }; +// Creates a [[time::instant]] from a [[datetime]] +export fn to_instant(dt: datetime) time::instant = { + return chrono::to_instant(to_moment(dt)); +}; + // Creates a [[datetime]] from a string, parsed according to a layout, // using [[strategy::ALL]], or fails otherwise. //