Skip to content

Commit e3d8cdc

Browse files
committed
time: improve the robustness of time_test.c.v (check if the diff is within ±1 second of the current timezone difference)
1 parent d1524fe commit e3d8cdc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vlib/time/time_test.c.v

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ fn test_tm_gmtoff() {
1515
dump(t2)
1616
dump(t1.nanosecond)
1717
dump(t2.nanosecond)
18-
diff := t1.unix() - t2.unix()
18+
diff := int(t1.unix() - t2.unix())
1919
dump(diff)
2020
dump(info.tm_gmtoff)
21-
assert info.tm_gmtoff == diff
21+
assert diff in [info.tm_gmtoff - 1, info.tm_gmtoff, info.tm_gmtoff + 1]
2222
}
2323
}

0 commit comments

Comments
 (0)