From 9dab931f44c021657e053296b5691ed98f9693c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matth=C3=A4us=20Wander?= Date: Sun, 6 Jun 2021 16:57:40 +0200 Subject: [PATCH] convert unixtime into UTC datetime --- parsedmarc/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parsedmarc/utils.py b/parsedmarc/utils.py index dbf525fb..177a880a 100644 --- a/parsedmarc/utils.py +++ b/parsedmarc/utils.py @@ -201,15 +201,15 @@ def get_reverse_dns(ip_address, cache=None, nameservers=None, timeout=2.0): def timestamp_to_datetime(timestamp): """ - Converts a UNIX/DMARC timestamp to a Python ``DateTime`` object + Converts a UNIX/DMARC timestamp to a Python ``DateTime`` object (UTC) Args: timestamp (int): The timestamp Returns: - DateTime: The converted timestamp as a Python ``DateTime`` object + DateTime: The converted timestamp as a Python ``DateTime`` object (UTC) """ - return datetime.fromtimestamp(int(timestamp)) + return datetime.utcfromtimestamp(int(timestamp)) def timestamp_to_human(timestamp): @@ -220,7 +220,7 @@ def timestamp_to_human(timestamp): timestamp: The timestamp Returns: - str: The converted timestamp in ``YYYY-MM-DD HH:MM:SS`` format + str: The converted timestamp in ``YYYY-MM-DD HH:MM:SS`` format (UTC) """ return timestamp_to_datetime(timestamp).strftime("%Y-%m-%d %H:%M:%S")