Skip to content

Commit

Permalink
Python 3.11: Update datetime command for current UTC time (#1128)
Browse files Browse the repository at this point in the history
  • Loading branch information
berquist authored Sep 11, 2024
1 parent d477ebc commit 1ffddbe
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/sst/core/testingframework/test_engine_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@
import traceback
import threading
import time
from datetime import datetime
import datetime

if sys.version_info.minor >= 11:
def get_current_time():
return datetime.datetime.now(datetime.UTC)
else:
def get_current_time():
return datetime.datetime.utcnow()

################################################################################

Expand Down Expand Up @@ -324,7 +331,7 @@ def startTest(self, test):
else:
self._testcase_name = "FailedTest"
self._testsuite_name = "FailedTest"
timestamp = datetime.utcnow().strftime("%Y_%m%d_%H:%M:%S.%f utc")
timestamp = get_current_time().strftime("%Y_%m%d_%H:%M:%S.%f utc")
self._junit_test_case = JUnitTestCase(self._test_name,
self._testcase_name,
timestamp=timestamp)
Expand Down

0 comments on commit 1ffddbe

Please sign in to comment.