diff options
-rw-r--r-- | lib/portage/repository/storage/hardlink_rcu.py | 8 | ||||
-rw-r--r-- | lib/portage/sync/modules/rsync/rsync.py | 6 | ||||
-rw-r--r-- | lib/portage/tests/sync/test_sync_local.py | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/lib/portage/repository/storage/hardlink_rcu.py b/lib/portage/repository/storage/hardlink_rcu.py index 6f464c8d0..e40c19085 100644 --- a/lib/portage/repository/storage/hardlink_rcu.py +++ b/lib/portage/repository/storage/hardlink_rcu.py @@ -266,7 +266,11 @@ class HardlinkRcuRepoStorage(RepoStorageInterface): st = os.stat(snap_path) except OSError: continue - snap_timestamp = datetime.datetime.utcfromtimestamp(st.st_mtime) - if (datetime.datetime.utcnow() - snap_timestamp) < snap_ttl: + snap_timestamp = datetime.datetime.fromtimestamp( + st.st_mtime, tz=datetime.timezone.utc + ) + if ( + datetime.datetime.now(datetime.timezone.utc) - snap_timestamp + ) < snap_ttl: continue await self._check_call(["rm", "-rf", snap_path]) diff --git a/lib/portage/sync/modules/rsync/rsync.py b/lib/portage/sync/modules/rsync/rsync.py index e89221ebc..29fee0a71 100644 --- a/lib/portage/sync/modules/rsync/rsync.py +++ b/lib/portage/sync/modules/rsync/rsync.py @@ -437,7 +437,11 @@ class RsyncSync(NewBase): raise RuntimeError("Timestamp not found in Manifest") if ( self.max_age != 0 - and (datetime.datetime.utcnow() - ts.ts).days > self.max_age + and ( + datetime.datetime.now(datetime.timezone.utc) + - ts.ts.replace(tzinfo=datetime.timezone.utc) + ).days + > self.max_age ): out.quiet = False out.ewarn( diff --git a/lib/portage/tests/sync/test_sync_local.py b/lib/portage/tests/sync/test_sync_local.py index 7e6158ee4..284c11777 100644 --- a/lib/portage/tests/sync/test_sync_local.py +++ b/lib/portage/tests/sync/test_sync_local.py @@ -141,7 +141,7 @@ class SyncLocalTestCase(TestCase): ) ) - bump_timestamp.timestamp = datetime.datetime.utcnow() + bump_timestamp.timestamp = datetime.datetime.now(datetime.timezone.utc) bump_timestamp_cmds = ((homedir, bump_timestamp),) |