1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

time: fix repetitive time.now().local().local().local() offsetting the time further and further (#13861)

This commit is contained in:
Vincenzo Palazzo
2022-03-31 23:11:17 +02:00
committed by GitHub
parent 9c1981a309
commit 02c80bd445
5 changed files with 21 additions and 2 deletions

View File

@ -254,3 +254,12 @@ fn test_since() {
d2 := time.since(t1)
assert d2 >= 40_000_000
}
// issue relate https://github.com/vlang/v/issues/13828
// problem: the local method add 2h on the time in a Linux machine
// the other machine are not tested in a local env
fn test_recursive_local_call() {
now_tm := time.now()
assert now_tm.str() == now_tm.local().str()
assert now_tm.local().str() == now_tm.local().local().str()
}