mercurial/utils/dateutil.py
branchstable
changeset 50752 faccec1edc2c
parent 48875 6000f5b25c9b
child 51285 9d3721552b6c
--- a/mercurial/utils/dateutil.py	Thu Jul 06 16:04:36 2023 +0200
+++ b/mercurial/utils/dateutil.py	Tue Jun 27 13:51:50 2023 +0200
@@ -83,10 +83,14 @@
         raise error.InputError(
             _(b"negative timestamp: %d") % timestamp, hint=hint
         )
-    delta = datetime.datetime.utcfromtimestamp(
+    tz = round(
         timestamp
-    ) - datetime.datetime.fromtimestamp(timestamp)
-    tz = delta.days * 86400 + delta.seconds
+        - datetime.datetime.fromtimestamp(
+            timestamp,
+        )
+        .replace(tzinfo=datetime.timezone.utc)
+        .timestamp()
+    )
     return timestamp, tz