[iso9660, fat and exfat fs add-ons] time convercion mistakes
|Reported by:||beos_zealot||Owned by:||nobody|
|Has a Patch:||yes||Platform:||All|
"ConvertRecDate" function converts time stored in iso9660 fs to time_t. The time of files/dirs is stored in iso9660 fs as localtime (meaning that timezone offset from GMT is allready included), so we have not to add "tz" value to "time", but subtract it to get a true GMT time (what we use internally).
The action takes place in Lithuania, so my timezone is GMT+2. For testing pusposes i touch'ed file and wrote it to iso9660 image. Time mismatch between touch'ed file (11:56) and file in iso image (15:56) is +4 hours (see attached picture: time-calculation_before-patch.jpg).
After enabling trace and adding additional debug lines i got this info: timezone offset "tz" value of file in iso image is 8, it means 8 intervals of 15min from GMT, that's (8*15)/60 = 2 hours = GMT+2 (so it's correct).
It happens that 2 hour time offset is added twice:
1) "ConvertRecDate" function adds +2 hours (tz=8) while converting time to time_t value (iso9660.cpp line 1005) 2) and +2 hours added when this time_t value gets converted to localtime when file is showed in Tracker (takes system's timezone settings into account = Lithuania GMT+2)
So 11:56 -> 13:56 -> 15:56.
If we subtract 2 hours (tz=8) while converting time in step 1) - everything returns to its place (see attached picture: time-calculation_after-patch.jpeg).
Then 11:56 -> 09:56 (GMT time) -> 11:56.
P.S. it appears that this computing error is very old and has been fixed in other posix OS'es:
1996 in Linux: https://www.kernel.org/pub/linux/kernel/v2.1/patch-2.1.32.bz2 (lines 3039-3099)
Change History (19)
by , 7 years ago
by , 7 years ago
comment:6 by , 7 years ago
|Component:||File Systems/ISO 9660 → File Systems|
|Summary:||[iso9660 fs add-on] time convertion mistake → [iso9660, fat and exfat fs add-ons] time convercion mistakes|