8000 tests/extmod/utime_time_ns.py: Relax bounds on time_ns measurement. · micropython/micropython@35a6f62 · GitHub
[go: up one dir, main page]

Skip to content

Commit 35a6f62

Browse files
committed
tests/extmod/utime_time_ns.py: Relax bounds on time_ns measurement.
Some devices have lower precision than 1ms for time_ns() (eg PYBv1.x has 3.9ms resolution of the RTC) so make the test more lenient for them. Signed-off-by: Damien George <damien@micropython.org>
1 parent b8f5f5c commit 35a6f62

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/extmod/utime_time_ns.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212

1313
t0 = utime.time_ns()
14-
utime.sleep_us(1000)
14+
utime.sleep_us(5000)
1515
t1 = utime.time_ns()
1616

1717
# Check that time_ns increases.
1818
print(t0 < t1)
1919

20-
# Check that time_ns counts correctly, but be very lenient with the upper bound (50ms).
21-
if 950000 < t1 - t0 < 50000000:
20+
# Check that time_ns counts correctly, but be very lenient with the bounds (2ms to 50ms).
21+
if 2000000 < t1 - t0 < 50000000:
2222
print(True)
2323
else:
2424
print(t0, t1, t1 - t0)

0 commit comments

Comments
 (0)
0