ref: 0c0a9801c0e2b92832a9f91d6a6e7f94e8ba277d
dir: /libstd/now.myr/
use sys
use "types.use"
use "fmt.use"
pkg std =
const now : (-> time)
;;
/* microseconds since epoch */
const now = {
var tm
var sec
var nsec
if sys.clock_gettime(`sys.Clockrealtime, &tm) == 0
sec = tm.sec
nsec = tm.nsec castto(uint64)
-> (sec*1_000_000 + nsec/1000) castto(time)
else
-> -1
;;
}