Skip to content

Commit 02a6293

Browse files
time: prevent linux time functions from being included in non-linux platforms (#26596)
1 parent f999bda commit 02a6293

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

vlib/time/time.c.v

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,26 @@ fn C.strftime(buf &char, maxsize usize, const_format &char, const_tm &C.tm) usiz
2525
pub fn now() Time {
2626
$if macos {
2727
return darwin_now()
28-
}
29-
$if windows {
28+
} $else $if windows {
3029
return win_now()
31-
}
32-
$if solaris {
30+
} $else $if solaris {
3331
return solaris_now()
32+
} $else {
33+
return linux_now()
3434
}
35-
return linux_now()
36-
/*
37-
// defaults to most common feature, the microsecond precision is not available
38-
// in this API call
39-
t := C.time(0)
40-
now := C.localtime(&t)
41-
return convert_ctime(*now, 0)
42-
*/
4335
}
4436

4537
// utc returns the current UTC time.
4638
pub fn utc() Time {
4739
$if macos {
4840
return darwin_utc()
49-
}
50-
$if windows {
41+
} $else $if windows {
5142
return win_utc()
52-
}
53-
$if solaris {
43+
} $else $if solaris {
5444
return solaris_utc()
45+
} $else {
46+
return linux_utc()
5547
}
56-
return linux_utc()
5748
}
5849

5950
fn time_with_unix(t Time) Time {

0 commit comments

Comments
 (0)