| 1 | module os |
| 2 | |
| 3 | // sleep_ms suspends the execution for a given duration (in milliseconds), without having to `import time` for a single time.sleep/1 call. |
| 4 | fn sleep_ms(dur i64) { |
| 5 | #let now = new Date().getTime() |
| 6 | #let toWait = BigInt(dur) |
| 7 | #while (new Date().getTime() < now + Number(toWait)) {} |
| 8 | |
| 9 | _ = dur // unused |
| 10 | } |
| 11 |