Skip to content

Commit a351442

Browse files
naively assume timezone is UTC
1 parent 3cda1e3 commit a351442

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

mne_bids/read.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,15 +401,10 @@ def _handle_scans_reading(scans_fname, raw, bids_path):
401401

402402
acq_time = datetime.strptime(acq_time, date_format)
403403

404-
if acq_time_is_utc:
404+
if acq_time_is_utc or acq_time.tzinfo is None:
405405
# Enforce setting timezone to UTC without additonal conversion
406406
acq_time = acq_time.replace(tzinfo=timezone.utc)
407407
else:
408-
# if timezone is not set, assume machine's local timezone
409-
if acq_time.tzinfo is None:
410-
local_tz = datetime.now().astimezone().tzinfo
411-
acq_time = acq_time.replace(tzinfo=local_tz)
412-
# Convert time offset to UTC
413408
acq_time = acq_time.astimezone(timezone.utc)
414409

415410
logger.debug(f"Loaded {scans_fname} scans file to set acq_time as {acq_time}.")

0 commit comments

Comments
 (0)