Archives and summer / winter file timestamps

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
Damel
Member
Member
Posts: 130
Joined: 2003-02-06, 01:11 UTC
Location: Prague, Czech Republic

Archives and summer / winter file timestamps

Post by *Damel »

1) I created TEST_FILE_1.bin in summertime (2015-07-01 on 1:00) and TEST_FILE_2.bin in wintertime (2015-12-01 on 1:00)
2) Then I pack these two files to ZIP in summertime
a) in Total Commander
b) in Windows Explorer
c) in 7zip
d) in WinRAR
3) Then I repeat that in wintertime too

Results:

Shown in TC / Windows Explorer in summertime/wintertime
TEST_FILE_1.bin__2015.07.01__01:00
TEST_FILE_2.bin__2015.12.01__01:00

ZIP from TC / Windows Explorer / 7zip__ created 2015-07-01.zip\
Shown in TC (CTRL+PgDown) in summertime____________Shown in TC (CTRL+PgDown) in wintertime
TEST_FILE_1.bin__2015.07.01__01:00________________TEST_FILE_1.bin__2015.07.01__02:00
TEST_FILE_2.bin__2015.12.01__01:00________________TEST_FILE_2.bin__2015.12.01__02:00

ZIP from TC / Windows Explorer / 7zip__ created 2015-12-01.zip\
Shown in TC (CTRL+PgDown) in summertime____________Shown in TC (CTRL+PgDown) in wintertime
TEST_FILE_1.bin__2015.07.01__00:00________________TEST_FILE_1.bin__2015.07.01__01:00
TEST_FILE_2.bin__2015.12.01__00:00________________TEST_FILE_2.bin__2015.12.01__01:00

ZIP from WinRar created 2015-07-01.zip\
Shown in TC (CTRL+PgDown) in summertime____________Shown in TC (CTRL+PgDown) in wintertime
TEST_FILE_1.bin__2015.07.01__01:00________________TEST_FILE_1.bin__2015.07.01__02:00
TEST_FILE_2.bin__2015.12.01__00:00________________TEST_FILE_2.bin__2015.12.01__01:00

ZIP from WinRar created 2015-12-01.zip\
Shown in TC (CTRL+PgDown) in summertime____________Shown in TC (CTRL+PgDown) in wintertime
TEST_FILE_1.bin__2015.07.01__01:00________________TEST_FILE_1.bin__2015.07.01__02:00
TEST_FILE_2.bin__2015.12.01__00:00________________TEST_FILE_2.bin__2015.12.01__01:00


There are two behavioural schemes:

A) Forget the daylight saving time, clock showed 1:00 when the file was created! TC/Windows Explorer follows this when shows file timestamp as 1:00 in summertime and wintertime too.

B) Don't forget about the daylight saving time! 1:00 in summer is in fact 0:00 in "normal"time. This scheme follows WinRAR.


If TC follows scheme A, OK, but inside archives this isn't preserved and whats is worse, after unpacking this makes real mess. Timestamps are 00:00 or 2:00, not 1:00. Mess.

And if ZIP from WinRAR is unpacked in WinRAR, timestamps are 1:00, but if is unpacked in TC, then it alters from 0:00 through 1:00 to 2:00, depends on actual date. Mess.


Bug is in inconsistencies of timestamps. Timestamp of unpacked file must be same as the original timestamp of file which was packed.
The best solution:
1. format C:
2. install TotalCmd
3. install Windows (optionally)
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Post by *milo1012 »

I really don't think that this counts as TC bug, but as a limitation of the archive format and a general problem:
Zip stores the timestamp as a hard-coded field, rather than e.g. an offset to a standard time, like UTC or a Unix time.
So with just a hardcoded value at hand, but without any timezone information, there is JUST NO WAY that any program is able to know in which timezone this particular file was created for real.
Please see
http://stackoverflow.com/questions/3725662/what-is-the-earliest-timestamp-value-that-is-supported-in-zip-file-format

WinRAR tries to be "intelligent" (your behavioural scheme B), but this violates expected behavior IMO.
(it can only use your computers local timezone. This may be right, but may be wrong if you shared this file with some other user on a different timezone.
Trying to unpack such file on a completely different timezone will mess up the timestamp anyway, due to the mentioned lack of a timezone information.
And I think this problem isn't limited to Zip files, but it occurs in some of the other archive formats too (all which lack a defined standard (UTC) time))



Maybe an OPTIONAL adjustment (like WinRAR and other programs do) can be implemented in TC.
To quote the above link:
Info-ZIP, JSE and TrueZIP apply the DST schedule (days where DST began and ended in any given year) for any date when converting times between system time and DOS date/time. This is as it should be. Vista’s Explorer, 7-Zip and WinZip apply only the DST savings, but do not apply the schedule. So they use the current DST savings for any date when converting times between system time and DOS date/time.
TC plugins: PCREsearch and RegXtract
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48079
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Indeed it's not a bug, it's a misfeature of different type of time encoding:
- ZIP and FAT32 store times as local time
- NTFS stores time as an offset to UTC (universal time)

During daylight saving time, the difference to UTC is 1 hour more, e.g. DST+1 (Western Europe) -> DST+2.

Now Windows XP was keeping the local time constant, so the time on NTFS drives changed by 1 hour when DST changed to winter time (and back).

Windows 7 changed that and kept UTC constant, so now the time on FAT32 drives (and in ZIP files, if handled correctly) changes by 1 hour.
Author of Total Commander
https://www.ghisler.com
User avatar
Damel
Member
Member
Posts: 130
Joined: 2003-02-06, 01:11 UTC
Location: Prague, Czech Republic

Post by *Damel »

Thank you both for your answers.

As I understand it now, can be solved this mess by a new option/checkbox "Preserve hardcoded timestamps", which means do not add 1/-1 hour to the timestamps of unpacked / viewed files from ZIP archives? Please.
The best solution:
1. format C:
2. install TotalCmd
3. install Windows (optionally)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48079
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

TC never adds or substracts time to the file timestamps when unpacking, it just sets the local time stored in the zip.
Author of Total Commander
https://www.ghisler.com
Post Reply