diff options
author | Damien George <damien@micropython.org> | 2021-02-01 18:44:28 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2021-02-01 18:44:28 +1100 |
commit | 35a6f6231e482936b7ef7e8fe3dfc790a7beb4ed (patch) | |
tree | 4f58830aa424785c35f75ebb3ad8863d4cce13a7 | |
parent | b8f5f5cd85e83fd136fac5e90ed5d486c2924a42 (diff) |
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>
-rw-r--r-- | tests/extmod/utime_time_ns.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/extmod/utime_time_ns.py b/tests/extmod/utime_time_ns.py index 8f3890f1c..0d13f839d 100644 --- a/tests/extmod/utime_time_ns.py +++ b/tests/extmod/utime_time_ns.py @@ -11,14 +11,14 @@ except (ImportError, AttributeError): t0 = utime.time_ns() -utime.sleep_us(1000) +utime.sleep_us(5000) t1 = utime.time_ns() # Check that time_ns increases. print(t0 < t1) -# Check that time_ns counts correctly, but be very lenient with the upper bound (50ms). -if 950000 < t1 - t0 < 50000000: +# Check that time_ns counts correctly, but be very lenient with the bounds (2ms to 50ms). +if 2000000 < t1 - t0 < 50000000: print(True) else: print(t0, t1, t1 - t0) |