mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-11 09:59:19 -04:00
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:
parent
04940e3d44
commit
f496497d92
2 changed files with 5 additions and 5 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in a new issue