tests/wipy: Improve robustness of time test.

This commit is contained in:
Daniel Campora 2015-09-27 12:32:02 +02:00
parent ef369249cb
commit 8192310dad

View File

@ -61,12 +61,12 @@ spot_test(-1072915201, (1965, 12, 31, 23, 59, 59, 4, 365))
t1 = time.time() t1 = time.time()
time.sleep(2) time.sleep(2)
t2 = time.time() t2 = time.time()
print(time.ticks_diff(t1, t2) == 2) print(abs(time.ticks_diff(t1, t2) -2) <= 1)
t1 = time.ticks_ms() t1 = time.ticks_ms()
time.sleep_ms(50) time.sleep_ms(50)
t2 = time.ticks_ms() t2 = time.ticks_ms()
print(time.ticks_diff(t1, t2) == 50) print(abs(time.ticks_diff(t1, t2)- 50) <= 1)
t1 = time.ticks_us() t1 = time.ticks_us()
time.sleep_us(1000) time.sleep_us(1000)