1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

time: consolidate the different sleep functions into time.wait(Duration) (#8853)

This commit is contained in:
zakuro
2021-02-22 00:05:03 +09:00
committed by GitHub
parent b1209aac1b
commit ac4791045f
49 changed files with 156 additions and 179 deletions

View File

@ -44,7 +44,7 @@ fn (mut ctx Context) println(s string) {
fn do_timeout(c &Context) {
mut ctx := c
time.sleep_ms(ctx.timeout_ms)
time.wait(ctx.timeout_ms * time.millisecond)
exit(ctx.exitcode)
}
@ -58,7 +58,7 @@ fn main() {
After a while (-timeout_ms), exit with (-exitcode).
This program is useful for platform independent testing
of child process/standart input/output control.
It is used in V\'s `os` module tests.
It is used in V's `os` module tests.
")
}
ctx.is_verbose = '-v' in args
@ -75,7 +75,7 @@ fn main() {
go do_timeout(&ctx)
for i := 1; true; i++ {
ctx.println('$i')
time.sleep_ms(ctx.period_ms)
time.wait(ctx.period_ms * time.millisecond)
}
time.sleep(100000)
time.wait(100 * time.second)
}