Skip to content
Snippets Groups Projects
Commit f5505b9a authored by Sybren A. Stüvel's avatar Sybren A. Stüvel
Browse files

Round timestamped paths to entire seconds.

Round away the milliseconds, as those aren't all that interesting.
Uniqueness is ensured by calling _unique_path().
parent 29281d48
No related branches found
Tags v2.0-beta10-worker3
No related merge requests found
......@@ -294,7 +294,10 @@ def _timestamped_path(path: Path) -> Path:
from datetime import datetime
mtime = path.stat().st_mtime
mdatetime = datetime.fromtimestamp(mtime)
# Round away the milliseconds, as those aren't all that interesting.
# Uniqueness is ensured by calling _unique_path().
mdatetime = datetime.fromtimestamp(round(mtime))
# Make the ISO-8601 timestamp a bit more eye- and filename-friendly.
iso = mdatetime.isoformat().replace('T', '_').replace(':', '')
......
......@@ -49,7 +49,7 @@ class MoveToFinalTest(AbstractCommandTest):
(dest / 'dest-subdir').mkdir()
(dest / 'dest-subdir' / 'sub-contents').touch()
os.utime(str(dest), (1330712280, 1330712292)) # fixed (atime, mtime) for testing
os.utime(str(dest), (1330712280.01, 1330712292.02)) # fixed (atime, mtime) for testing
# Run the command.
task = self.cmd.run({'src': str(src), 'dest': str(dest)})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment