From f6d5046fa7cdd708639bf478dd216e28c18b6fa0 Mon Sep 17 00:00:00 2001 From: aiuto Date: Thu, 21 Mar 2024 15:25:17 -0400 Subject: [PATCH] Stop using datetime.utcfromtimestamp() (#838) Fixes #826 --- pkg/private/zip/build_zip.py | 2 +- tests/zip/zip_test_lib.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/private/zip/build_zip.py b/pkg/private/zip/build_zip.py index 5a191b7a..c2ff3644 100644 --- a/pkg/private/zip/build_zip.py +++ b/pkg/private/zip/build_zip.py @@ -74,7 +74,7 @@ def _combine_paths(left, right): def parse_date(ts): - ts = datetime.datetime.utcfromtimestamp(ts) + ts = datetime.datetime.fromtimestamp(ts, tz=datetime.timezone.utc) return (ts.year, ts.month, ts.day, ts.hour, ts.minute, ts.second) diff --git a/tests/zip/zip_test_lib.py b/tests/zip/zip_test_lib.py index ebb0b603..e6c305f9 100644 --- a/tests/zip/zip_test_lib.py +++ b/tests/zip/zip_test_lib.py @@ -31,7 +31,7 @@ _ZIP_EPOCH_S = int(_ZIP_EPOCH_DT.timestamp()) def seconds_to_ziptime(s): - dt = datetime.datetime.utcfromtimestamp(s) + dt = datetime.datetime.fromtimestamp(s, tz=datetime.timezone.utc) return (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second)