diff --git a/vlib/time/time.c.v b/vlib/time/time.c.v index 6c8269eed8..38dc7ad323 100644 --- a/vlib/time/time.c.v +++ b/vlib/time/time.c.v @@ -31,14 +31,14 @@ pub fn now() Time { $if solaris { return solaris_now() } - $if linux || android { - return linux_now() - } + return linux_now() + /* // defaults to most common feature, the microsecond precision is not available // in this API call t := C.time(0) now := C.localtime(&t) return convert_ctime(*now, 0) + */ } // utc returns the current UTC time. @@ -52,14 +52,14 @@ pub fn utc() Time { $if solaris { return solaris_utc() } - $if linux || android { - return linux_utc() - } + return linux_utc() + /* // defaults to most common feature, the microsecond precision is not available // in this API call t := C.time(0) _ = C.time(&t) return unix2(i64(t), 0) + */ } // new_time returns a time struct with calculated Unix time. diff --git a/vlib/time/time_test.v b/vlib/time/time_test.v index bf26df5ba5..16ad54d179 100644 --- a/vlib/time/time_test.v +++ b/vlib/time/time_test.v @@ -210,16 +210,21 @@ fn test_unix_time() { t1 := time.utc() time.sleep(50 * time.millisecond) t2 := time.utc() + eprintln('t1: $t1') + eprintln('t2: $t2') ut1 := t1.unix_time() ut2 := t2.unix_time() + eprintln('ut1: $ut1') + eprintln('ut2: $ut2') assert ut2 - ut1 < 2 // utm1 := t1.unix_time_milli() utm2 := t2.unix_time_milli() + eprintln('utm1: $utm1') + eprintln('utm2: $utm2') assert (utm1 - ut1 * 1000) < 1000 assert (utm2 - ut2 * 1000) < 1000 // - // println('utm1: $utm1 | utm2: $utm2') assert utm2 - utm1 > 2 assert utm2 - utm1 < 999 }