Skip to content

Commit 8bcbcdc

Browse files
Improve pure time precision
Signed-off-by: Ashwini Kumar Pandey <ashwini165@gmail.com>
1 parent b3b8acf commit 8bcbcdc

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

python/fledge/tasks/purge/purge.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
All these statistics are inserted into the log table
3030
"""
3131
import time
32-
import pytz
33-
from datetime import datetime, timedelta
32+
33+
from datetime import datetime, timedelta, timezone
3434

3535
from fledge.common import statistics
3636
from fledge.common.audit_logger import AuditLogger
@@ -134,8 +134,8 @@ async def purge_data(self, config):
134134
unsent_retained = 0
135135
duration = 0
136136
method = None
137-
timezone = pytz.timezone('UTC') # You can replace 'UTC' with your desired timezone
138-
start_time = datetime.now(timezone).strftime('%Y-%m-%d %H:%M:%S.%f %Z%z')
137+
138+
start_time = datetime.now(timezone.utc).isoformat(' ')
139139

140140
if config['retainUnsent']['value'].lower() == "purge unsent":
141141
flag = "purge"
@@ -241,7 +241,7 @@ async def purge_data(self, config):
241241
# skip logging as its already done in details for this operation in case of error
242242
# FIXME: check if ex.error jdoc has retryable True then retry the operation else move on
243243
pass
244-
end_time = datetime.now(timezone).strftime('%Y-%m-%d %H:%M:%S.%f %Z%z')
244+
end_time = datetime.now(timezone.utc).isoformat(' ')
245245

246246
if total_rows_removed > 0:
247247
""" Only write an audit log entry when rows are removed """

0 commit comments

Comments
 (0)