mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
time: use Duration(C.INT64_MAX)
as infinite (#10539)
This commit is contained in:
@ -29,8 +29,8 @@ fn @select(handle int, test Select, timeout time.Duration) ?bool {
|
||||
C.FD_ZERO(&set)
|
||||
C.FD_SET(handle, &set)
|
||||
|
||||
seconds := timeout.milliseconds() / 1000
|
||||
microseconds := timeout - (seconds * time.second)
|
||||
seconds := timeout / time.second
|
||||
microseconds := time.Duration(timeout - (seconds * time.second)).microseconds()
|
||||
|
||||
mut tt := C.timeval{
|
||||
tv_sec: u64(seconds)
|
||||
@ -63,9 +63,8 @@ fn @select(handle int, test Select, timeout time.Duration) ?bool {
|
||||
// wait_for_common wraps the common wait code
|
||||
fn wait_for_common(handle int, deadline time.Time, timeout time.Duration, test Select) ? {
|
||||
if deadline.unix == 0 {
|
||||
// only accept infinite_timeout as a valid
|
||||
// negative timeout - it is handled in @select however
|
||||
if timeout < 0 && timeout != unix.infinite_timeout {
|
||||
// do not accept negative timeout
|
||||
if timeout < 0 {
|
||||
return net.err_timed_out
|
||||
}
|
||||
ready := @select(handle, test, timeout) ?
|
||||
@ -117,7 +116,7 @@ const (
|
||||
// infinite_timeout should be given to functions when an infinite_timeout is wanted (i.e. functions
|
||||
// only ever return with data)
|
||||
const (
|
||||
infinite_timeout = time.Duration(-1)
|
||||
infinite_timeout = time.infinite
|
||||
)
|
||||
|
||||
[inline]
|
||||
|
Reference in New Issue
Block a user