diff options
Diffstat (limited to 'tests/extmod/vfs_lfs_mtime.py')
-rw-r--r-- | tests/extmod/vfs_lfs_mtime.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/extmod/vfs_lfs_mtime.py b/tests/extmod/vfs_lfs_mtime.py index 0108076884..bacdd2246c 100644 --- a/tests/extmod/vfs_lfs_mtime.py +++ b/tests/extmod/vfs_lfs_mtime.py @@ -3,6 +3,7 @@ try: import utime, uos + utime.time utime.sleep uos.VfsLfs2 except (ImportError, AttributeError): @@ -46,6 +47,7 @@ def test(bdev, vfs_class): vfs = vfs_class(bdev, mtime=True) # Create an empty file, should have a timestamp. + current_time = int(utime.time()) vfs.open("test1", "wt").close() # Wait 1 second so mtime will increase by at least 1. @@ -54,10 +56,15 @@ def test(bdev, vfs_class): # Create another empty file, should have a timestamp. vfs.open("test2", "wt").close() - # Stat the files and check that test1 is older than test2. + # Stat the files and check mtime is non-zero. stat1 = vfs.stat("test1") stat2 = vfs.stat("test2") print(stat1[8] != 0, stat2[8] != 0) + + # Check that test1 has mtime which matches time.time() at point of creation. + print(current_time <= stat1[8] <= current_time + 1) + + # Check that test1 is older than test2. print(stat1[8] < stat2[8]) # Wait 1 second so mtime will increase by at least 1. |