diff --git a/neo/rawio/plexon2rawio/plexon2rawio.py b/neo/rawio/plexon2rawio/plexon2rawio.py index ef4359cab..4b2d08d88 100644 --- a/neo/rawio/plexon2rawio/plexon2rawio.py +++ b/neo/rawio/plexon2rawio/plexon2rawio.py @@ -223,7 +223,11 @@ def _parse_header(self): # invalid datetime information if year is <1 if tmo.tm_year != 0: microseconds = block_info['m_CreatorDateTimeMilliseconds'] * 1000 - dt = datetime(year=tmo.tm_year, month=tmo.tm_mon, day=tmo.tm_mday, hour=tmo.tm_hour, + # tm_mon range is 0..11 https://cplusplus.com/reference/ctime/tm/ + # python is 1..12 https://docs.python.org/3/library/datetime.html#datetime.datetime + # so month needs to be tm_mon+1; also tm_sec could cause problems in the case of leap + # seconds, but this is harder to defend against. + dt = datetime(year=tmo.tm_year, month=tmo.tm_mon+1, day=tmo.tm_mday, hour=tmo.tm_hour, minute=tmo.tm_min, second=tmo.tm_sec, microsecond=microseconds) # ignoring daylight saving time information for now as timezone is unknown