Skip to content

Commit

Permalink
MNT: utcnow()now(tz=timezone.utc)
Browse files Browse the repository at this point in the history
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow

Because naive datetime objects are treated by many datetime methods as local
times, it is preferred to use aware datetimes to represent times in UTC.
As such, the recommended way to create an object representing the current
time in UTC is by calling datetime.now(timezone.utc).

Deprecated since version 3.12: Use datetime.now() with UTC instead.

Co-authored-by: Chris Markiewicz <[email protected]>
  • Loading branch information
DimitriPapadopoulos and effigies committed Oct 14, 2023
1 parent 9f05091 commit e26a13b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions niworkflows/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
""" py.test configuration file """
import os
from pathlib import Path
from datetime import datetime as dt
import datetime as dt
import pytest
from templateflow.api import get as get_template
from niworkflows.testing import test_data_env, data_env_canary
Expand All @@ -34,7 +34,7 @@

def _run_interface_mock(objekt, runtime):
runtime.returncode = 0
runtime.endTime = dt.isoformat(dt.utcnow())
runtime.endTime = dt.datetime.isoformat(dt.datetime.now(dt.timezone.utc))

objekt._out_report = os.path.abspath(objekt.inputs.out_report)
objekt._post_run_hook(runtime)
Expand Down

0 comments on commit e26a13b

Please sign in to comment.