Skip to content

Commit

Permalink
Merge pull request #264 from nonhermitian/patch-datetime
Browse files Browse the repository at this point in the history
parsing datetime in py<3.11
  • Loading branch information
nonhermitian authored Nov 7, 2024
2 parents 4634cf5 + 7272f9b commit f10ee07
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mthree/mitigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,10 @@ def _job_thread(jobs, mit, qubits, num_cal_qubits, generator):
timestamp = timestamp.isoformat()
# Go to UTC times because we are going to use this for
# resultsDB storage as well
dt = datetime.datetime.fromisoformat(timestamp)
try:
dt = datetime.datetime.fromisoformat(timestamp)
except ValueError:
dt = datetime.datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%fZ")
dt_utc = dt.astimezone(datetime.timezone.utc)
mit.cal_timestamp = dt_utc.isoformat()
# A list of qubits with bad meas cals
Expand Down

0 comments on commit f10ee07

Please sign in to comment.