Skip to content

Commit 6cd3254

Browse files
committed
fix (JobLoggingDB): correctly calculate StatusTimeOrder in UTC
1 parent 2881a6e commit 6cd3254

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/DIRAC/WorkloadManagementSystem/DB/JobLoggingDB.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ def addLoggingRecord(
7171
except Exception:
7272
self.log.exception("Exception while date evaluation")
7373
_date = datetime.datetime.utcnow()
74-
epoc = time.mktime(_date.timetuple()) + _date.microsecond / 1000000.0 - MAGIC_EPOC_NUMBER
74+
75+
# We need to specify that timezone is UTC because otherwise timestamp
76+
# assumes local time while we mean UTC.
77+
epoc = _date.replace(tzinfo=datetime.timezone.utc).timestamp() - MAGIC_EPOC_NUMBER
7578

7679
cmd = (
7780
"INSERT INTO LoggingInfo (JobId, Status, MinorStatus, ApplicationStatus, "

0 commit comments

Comments
 (0)