Reference · reference
time module
use time reads the wall clock and the monotonic clock, sleeps, and formats timestamps. config-weave registers it from wscript-std. No function in this module fails. Its common use is a resource that converges on an age rather than on a state, such as a package cache refreshed within the last N minutes: compare the modified field of fs::metadata against now.
now_unix and now_millis
now_unix now_millis The wall-clock time since the Unix epoch, as seconds with sub-second precision or as whole milliseconds. Prefer now_millis() / 1000 when the other side of a comparison is an integer, so the comparison stays in integers.
instant and elapsed
instant elapsed instant reads the monotonic clock as seconds since a process-wide anchor. elapsed returns the seconds since an earlier instant. Use these for durations rather than a difference of now_unix calls, because the wall clock can step backwards when NTP corrects it or a VM resumes from a snapshot.
sleep
sleep
Blocks the script's thread for the given milliseconds. A negative value is treated as zero.
format_iso
format_iso Formats a Unix timestamp as an ISO 8601 string in UTC.
use fs
use time
// Refresh when the stamp file is missing or older than max_age seconds.
if !is_file
let meta = metadata?
let modified = if let Some = meta.get if let Some = m.as_int else
} else
Ok
}