[Bug]: Issue with Default session_start_time timezone in mock_NWBFile #2013
Labels
category: bug
errors in the code or code behavior
priority: medium
non-critical problem and/or affecting only a small set of NWB users
What happened?
Description
A potential bug occurs when using a mock function for creating
NWBFile
objects. The function setsession_start_time
to datetime(1970, 1, 1, tzinfo=tzlocal()). This results in an OSError: [Errno 22] Invalid argument when attempting to write the file using pynwb.NWBHDF5IO. The issue seems to be caused by the interaction between tzlocal() and early datetime values (e.g., the epoch time 1970-01-01), particularly in systems located in time zones earlier than UTC, where the local time would fall outside the valid range for the epoch.Steps to Reproduce
Traceback
Operating System
Windows
Python Executable
Conda
Python Version
3.11
Package Versions
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: