-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Issue with Default session_start_time timezone in mock_NWBFile #2013
Comments
Thanks for pointing that out @alessandratrapani! It looks like this may be a Windows specific error so I'm not able to reproduce locally, but if I understand correctly I think we should update the default |
I don't know if it is Windows specific, it seems to me it is "timezone" specific 😆, maybe that's why it is difficult to reproduce. |
Are there downsides to using the machine time and timezone when using the mock? |
I don't see any issues |
@alessandratrapani does I have a slight preference for keeping the 1970, since it is clearly filler data and won't be mistaken for real data. If that doesn't work, we can use the current time. |
Yes, it is working |
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: