Skip to content

Commit

Permalink
Replace ZoneInfo with datetime.timezone
Browse files Browse the repository at this point in the history
Signed-off-by: even-wei <[email protected]>
  • Loading branch information
even-wei authored and kentwelcome committed Dec 25, 2024
1 parent 4735c96 commit ab81657
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions recce/event/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from contextlib import contextmanager
from datetime import datetime
from json import JSONDecodeError
from zoneinfo import ZoneInfo
from datetime import timezone

import portalocker
import requests
Expand Down Expand Up @@ -89,8 +89,8 @@ def log_event(self, event_prop, event_type, event_triggered_at: datetime = None,
if event_triggered_at is None:
created_at = datetime.now()
else:
# Convert to GMT timezone
created_at = event_triggered_at.astimezone(ZoneInfo("GMT"))
# Convert to UTC timezone
created_at = event_triggered_at.astimezone(timezone.utc)
python_version = f'{sys.version_info.major}.{sys.version_info.minor}'

# when the recce is running in automation use cases
Expand Down

0 comments on commit ab81657

Please sign in to comment.