time: fix sleep() on windows

pull/9004/head
Alexander Medvednikov 2021-02-27 20:53:27 +03:00
parent 3a2d696fac
commit e6b4f9ff09
1 changed files with 6 additions and 0 deletions

View File

@ -214,6 +214,12 @@ pub struct C.timeval {
}
// wait makes the calling thread sleep for a given duration (in nanoseconds).
[deprecated: 'call time.sleep(n * time.second)']
pub fn wait(duration Duration) {
C.Sleep(int(duration / millisecond))
}
// sleep makes the calling thread sleep for a given duration (in nanoseconds).
pub fn sleep(duration Duration) {
C.Sleep(int(duration / millisecond))
}