Skip to content

Commit

Permalink
fix (JobLoggingDB): correctly calculate StatusTimeOrder in UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
chaen committed Nov 22, 2023
1 parent 2881a6e commit 6cd3254
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/DIRAC/WorkloadManagementSystem/DB/JobLoggingDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ def addLoggingRecord(
except Exception:
self.log.exception("Exception while date evaluation")
_date = datetime.datetime.utcnow()
epoc = time.mktime(_date.timetuple()) + _date.microsecond / 1000000.0 - MAGIC_EPOC_NUMBER

# We need to specify that timezone is UTC because otherwise timestamp
# assumes local time while we mean UTC.
epoc = _date.replace(tzinfo=datetime.timezone.utc).timestamp() - MAGIC_EPOC_NUMBER

cmd = (
"INSERT INTO LoggingInfo (JobId, Status, MinorStatus, ApplicationStatus, "
Expand Down

0 comments on commit 6cd3254

Please sign in to comment.