From ad63b48f4423e658ae17391c1d123f6b55d26c10 Mon Sep 17 00:00:00 2001 From: jsta Date: Fri, 21 Jan 2022 15:38:28 -0700 Subject: [PATCH] handle negative timestamps on Windows --- python/ee/cli/commands.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/ee/cli/commands.py b/python/ee/cli/commands.py index 1d76bed21..0b655a338 100644 --- a/python/ee/cli/commands.py +++ b/python/ee/cli/commands.py @@ -202,8 +202,10 @@ def _timestamp_ms_for_datetime(datetime_obj): def _cloud_timestamp_for_timestamp_ms(timestamp_ms): """Returns a Cloud-formatted date for the given millisecond timestamp.""" # Desired format is like '2003-09-07T19:30:12.345Z' - return datetime.datetime.utcfromtimestamp( - timestamp_ms / 1000.0).isoformat() + 'Z' + return ( + datetime.datetime.utcfromtimestamp(0) + + datetime.timedelta(seconds=timestamp_ms / 1000) +).isoformat() + "Z" def _parse_millis(millis):