21 lines
674 B
EmacsLisp
21 lines
674 B
EmacsLisp
// time-arithmetic.el — Instant + Duration -> Instant, then Instant - Instant
|
|
// -> Duration. The codegen routes each BinOp through the typed wrappers
|
|
// (el_instant_add_dur, el_instant_diff). Returns 1 if the elapsed span is at
|
|
// least 5 minutes, 0 otherwise. Because the two now() calls are very close
|
|
// together, the span is very nearly 5.minutes, so >= 5.minutes holds.
|
|
|
|
// `test` is reserved; using `run_test` instead.
|
|
fn run_test() -> Int {
|
|
let later: Instant = now() + 5.minutes
|
|
let span: Duration = later - now()
|
|
if span >= 5.minutes {
|
|
return 1
|
|
} else {
|
|
return 0
|
|
}
|
|
}
|
|
|
|
fn main() -> Void {
|
|
println(int_to_str(run_test()))
|
|
}
|