time calculations: avoid floating point

Do not use 1e9 if it is not mean to be a fp calculation anyway, but rather use 10**9 for pure integer calculations.
This commit is contained in:
Thomas Waldmann 2026-03-02 23:03:44 +01:00
parent 04940e3d44
commit f496497d92
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01
2 changed files with 5 additions and 5 deletions

View file

@ -223,7 +223,7 @@ def test_nobirthtime(archivers, request):
assert same_ts_ns(sti.st_birthtime * 1e9, birthtime * 1e9)
assert same_ts_ns(sto.st_birthtime * 1e9, mtime * 1e9)
assert same_ts_ns(sti.st_mtime_ns, sto.st_mtime_ns)
assert same_ts_ns(sto.st_mtime_ns, mtime * 1e9)
assert same_ts_ns(sto.st_mtime_ns, mtime * 10**9)
def test_create_stdin(archivers, request):

View file

@ -153,13 +153,13 @@ def test_atime(archivers, request):
sti = os.stat("input/file1")
sto = os.stat("output/input/file1")
assert same_ts_ns(sti.st_mtime_ns, sto.st_mtime_ns)
assert same_ts_ns(sto.st_mtime_ns, mtime * 1e9)
assert same_ts_ns(sto.st_mtime_ns, mtime * 10**9)
if have_noatime:
assert same_ts_ns(sti.st_atime_ns, sto.st_atime_ns)
assert same_ts_ns(sto.st_atime_ns, atime * 1e9)
assert same_ts_ns(sto.st_atime_ns, atime * 10**9)
else:
# it touched the input file's atime while backing it up
assert same_ts_ns(sto.st_atime_ns, atime * 1e9)
assert same_ts_ns(sto.st_atime_ns, atime * 10**9)
@pytest.mark.skipif(not is_utime_fully_supported(), reason="cannot setup and execute test without utime")
@ -179,7 +179,7 @@ def test_birthtime(archivers, request):
assert same_ts_ns(sti.st_birthtime * 1e9, sto.st_birthtime * 1e9)
assert same_ts_ns(sto.st_birthtime * 1e9, birthtime * 1e9)
assert same_ts_ns(sti.st_mtime_ns, sto.st_mtime_ns)
assert same_ts_ns(sto.st_mtime_ns, mtime * 1e9)
assert same_ts_ns(sto.st_mtime_ns, mtime * 10**9)
@pytest.mark.skipif(is_win32, reason="frequent test failures on github CI on win32")