application/octet-stream
•
832 B
•
21 lines
;; Nujel - Copyright (C) 2020-2021 - Benjamin Vincent Schulenburg
;; This project uses the MIT license, a copy should be included under /LICENSE
;;
;; Time related λs
[export seconds [defn seconds [timestamp]
"Return the seconds part of TIMESTAMP, defaults to current time"
[rem [or timestamp [time]] 60]]]
[export minutes [defn minutes [timestamp]
"Return the minutes part of TIMESTAMP, defaults to current time"
[rem [/ [or timestamp [time]] 60] 60]]]
[export hours [defn hours [timestamp]
"Return the hours part of TIMESTAMP, defaults to current time"
[rem [/ [or timestamp [time]] 3600] 24]]]
[deftest 34 [time/seconds 1637755714]]
[deftest 8 [time/minutes 1637755714]]
[deftest 12 [time/hours 1637755714]]
[deftest 59 [time/seconds 1637755739]]
[deftest 0 [time/seconds 1637755740]]