danielhrisca / asammdf

Fast Python reader and editor for ASAM MDF / MF4 (Measurement Data Format) files
GNU Lesser General Public License v3.0
611 stars 216 forks source link

start_time Function Returning Date Out of Standard Format #1016

Open MatheusFreitas25 opened 1 month ago

MatheusFreitas25 commented 1 month ago

Python version

('python=3.11.2 (v3.11.2:878ead1ac1, Feb 7 2023, 10:02:41) [Clang 13.0.0 ' '(clang-1300.0.29.30)]') 'os=macOS-14.0-arm64-arm-64bit' 'numpy=1.26.4' 'asammdf=7.3.16'

MDF version

4.10

Code snippet

mdf_start_time = mdf.start_time print(mdf_start_time) -> 2024-04-17 11:21:39+02:00 start_time_utc = mdf_start_time.astimezone(pytz.utc) print(start_time_utc) -> 2024-04-17 09:21:39+00:00

Description

We have an MF4 file where the Data date/time in the header is:

Data date/time: 17.04.2024 13:09:32

When running the above code, I find that the start time is:

2024-04-17 11:21:39+02:00

where I believe the minute 21 is the first signal record (perhaps).

The issue is that following the ISO 8601 standard, Python and other languages will interpret this date as UTC:

2024-04-17 09:21:39+00:00

So, I believe that in reality, the start time should return:

2024-04-17 13:21:39+02:00

And when converted to UTC, it would be:

2024-04-17 11:21:39+00:00