mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vlib: remove many deprecated functions (#10972)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
module time
|
||||
|
||||
fn assert_greater_time(ms int, t1 Time) {
|
||||
wait(ms * millisecond)
|
||||
sleep(ms * millisecond)
|
||||
t2 := now()
|
||||
assert t2 > t1
|
||||
}
|
||||
|
||||
@@ -336,18 +336,6 @@ pub fn sleep(seconds int) {
|
||||
}
|
||||
*/
|
||||
|
||||
// sleep_ms makes the calling thread sleep for a given number of milliseconds.
|
||||
[deprecated: 'call time.sleep(n * time.millisecond)']
|
||||
pub fn sleep_ms(milliseconds int) {
|
||||
wait(milliseconds * time.millisecond)
|
||||
}
|
||||
|
||||
// usleep makes the calling thread sleep for a given number of microseconds.
|
||||
[deprecated: 'call time.sleep(n * time.microsecond)']
|
||||
pub fn usleep(microseconds int) {
|
||||
wait(microseconds * time.microsecond)
|
||||
}
|
||||
|
||||
// is_leap_year checks if a given a year is a leap year.
|
||||
pub fn is_leap_year(year int) bool {
|
||||
return (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0)
|
||||
|
||||
@@ -129,13 +129,6 @@ pub fn zero_timespec() C.timespec {
|
||||
return ts
|
||||
}
|
||||
|
||||
// wait makes the calling thread sleep for a given duration (in nanoseconds).
|
||||
[deprecated: 'call time.sleep(n * time.second)']
|
||||
pub fn wait(duration Duration) {
|
||||
ts := &C.timespec{duration / second, duration % second}
|
||||
C.nanosleep(ts, C.NULL)
|
||||
}
|
||||
|
||||
// sleep makes the calling thread sleep for a given duration (in nanoseconds).
|
||||
pub fn sleep(duration Duration) {
|
||||
mut req := C.timespec{duration / second, duration % second}
|
||||
|
||||
@@ -215,12 +215,6 @@ pub struct C.timeval {
|
||||
tv_usec u64
|
||||
}
|
||||
|
||||
// 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))
|
||||
|
||||
Reference in New Issue
Block a user