diff --git a/tests/extmod/vfs_lfs_mtime.py b/tests/extmod/vfs_lfs_mtime.py index 3d163dc26..d4404de4d 100644 --- a/tests/extmod/vfs_lfs_mtime.py +++ b/tests/extmod/vfs_lfs_mtime.py @@ -3,7 +3,7 @@ try: import time, vfs - time.time + time.time_ns time.sleep vfs.VfsLfs2 except (ImportError, AttributeError): @@ -47,7 +47,8 @@ def test(bdev, vfs_class): fs = vfs_class(bdev, mtime=True) # Create an empty file, should have a timestamp. - current_time = int(time.time()) + # Use time_ns() for current time because that's what's used for VfsLfs2 time. + current_time = time.time_ns() // 1_000_000_000 fs.open("test1", "wt").close() # Wait 1 second so mtime will increase by at least 1. @@ -61,7 +62,7 @@ def test(bdev, vfs_class): stat2 = fs.stat("test2") print(stat1[8] != 0, stat2[8] != 0) - # Check that test1 has mtime which matches time.time() at point of creation. + # Check that test1 has mtime which matches time.time_ns() at point of creation. print(current_time <= stat1[8] <= current_time + 1) # Check that test1 is older than test2.