Source code of internal zip packer to fix timestams in UTC, instead of localtime

English support forum

Moderators: white, Hacker, petermad, Stefan2

User avatar
angel
Junior Member
Junior Member
Posts: 46
Joined: 2014-10-17, 06:54 UTC
Location: Sofia, Bulgaria, Europe

Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *angel »

Is WCMZIP32.DLL or WCMZIP64.DLL the internal zip packer?
#381167 Single user license [08:50, 26.10.2022]
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *Dalai »

Yes it is. Considerung your other thread, I'd like you to keep in mind that it's not as simple as replacing these DLLs. Not the programs creating ZIP archives are the issue but the ZIP archive format itself (or its spec). Even if TC would store timestamps in UTC when creating archives, other packers would show all timestamps wrong for these archives, making TC incompatible to everything else.

Just because it's been popular for a very long time, the ZIP archive format might not be the first choice when packing/compressing something.

As I already said in the other thread: Use a different archive format when you need to store UTC timestamps. 7-zip is a free and open source format (and program) and TC can extract such archives OOTB and it can create them with the help of a plugin. And it even comes with the bonus of having a much better compression ratio than ZIP. But then again, that applies to most of the other archive formats...

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
angel
Junior Member
Junior Member
Posts: 46
Joined: 2014-10-17, 06:54 UTC
Location: Sofia, Bulgaria, Europe

Re: Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *angel »

I though that the point is to make TC better. At this point the times in zip are very bad and I am trying to find a way to resolve it. To change to a different packer do not resolve the problem.
Zip is the most popular and in TC->configuration->Zip packer (has own section, not 7zip, not arj, nor rar, etc. you get the point)
7zip is better in my opinion than zip, but zip= 90% of all world archivers (maybe not yours), works in 90% of the time in TC (when TC is available)
But what I know - I have 12 post, you 8K, so …

Мerry welcome to the holidays
Best Regards
#381167 Single user license [08:50, 26.10.2022]
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *Dalai »

angel wrote: 2021-12-24, 13:30 UTCI though that the point is to make TC better.
Yes, of course. But it's not a good idea to make it incompatible with other programs when it comes to such a standard, is it? Imagine you get a ZIP archive from someone else created in a different archiver. Would it help that TC interprets timestamps in UTC? Of course not, quite the opposite actually. Neither does it the other way around. TC would only be compatible with itself. Does that make TC better?

To change to a different packer do not resolve the problem.
I disagree. Well, except when it comes to archives created by other people. But when you tell them that timestamps are important, perhaps you can convince them to use a different archive format in cases where it matters.

7zip is better in my opinion than zip, but zip= 90% of all world archivers (maybe not yours)
ZIP archives are as widespread for a reason: Its simplicity and widespread support to handle them. But timestamps are not important for the majority of cases where ZIPs are used.

But what I know - I have 12 post, you 8K, so …
That doesn't matter. Everyone can have an opinion and express it. Discussions are bound to happen sooner or later, especially when it comes to controversial topics or details on how to implement things.

Мerry welcome to the holidays
Merry Christmas (or X-mas) to you and everybody else!

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *ghisler(Author) »

These dlls only do the actual packing of a file, not create the actual ZIP file structure.
Author of Total Commander
https://www.ghisler.com
User avatar
angel
Junior Member
Junior Member
Posts: 46
Joined: 2014-10-17, 06:54 UTC
Location: Sofia, Bulgaria, Europe

Re: Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *angel »

ghisler(Author) wrote: 2021-12-24, 14:28 UTC These dlls only do the actual packing of a file, not create the actual ZIP file structure.
I wonder, is it possible (for less resources like time and energy) to save UTC for zip in zip comments field and TC to read the DateTime from that filed, not from DateTime of the zip?
#381167 Single user license [08:50, 26.10.2022]
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *Horst.Epp »

angel wrote: 2021-12-25, 09:21 UTC
ghisler(Author) wrote: 2021-12-24, 14:28 UTC These dlls only do the actual packing of a file, not create the actual ZIP file structure.
I wonder, is it possible (for less resources like time and energy) to save UTC for zip in zip comments field and TC to read the DateTime from that filed, not from DateTime of the zip?
Please stop this useless discussion.
There is no need to make anything special for Zip archives in TC.
As already said above, there is 7zip as a free format which is used around the world,
fully supported by TC storing Date/Time in UTC.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *Dalai »

ghisler(Author) wrote: 2021-12-24, 14:28 UTCThese dlls only do the actual packing of a file, not create the actual ZIP file structure.
Does that mean that TC itself (totalcmd.exe/totalcmd64.exe) creates the ZIP file structure, and the DLL just delivers a stream of compressed data? Does this apply to other archive formats natively supported by TC? What about packer plugins?

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
angel
Junior Member
Junior Member
Posts: 46
Joined: 2014-10-17, 06:54 UTC
Location: Sofia, Bulgaria, Europe

Re: Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *angel »

Solution for those who want to use zip and to preserve DST and different timezones in zip archives:
viewtopic.php?p=408612#p408612
#381167 Single user license [08:50, 26.10.2022]
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *ghisler(Author) »

2angel
If you (or anyone else) wants me to change the handling of time stamps in zip, just send me some sample code and I will integrate it into TC.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *petermad »

and I will integrate it into TC
If you do - please make it optional.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
angel
Junior Member
Junior Member
Posts: 46
Joined: 2014-10-17, 06:54 UTC
Location: Sofia, Bulgaria, Europe

Re: Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *angel »

ghisler(Author) wrote: 2021-12-27, 16:07 UTC 2angel
If you (or anyone else) wants me to change the handling of time stamps in zip, just send me some sample code and I will integrate it into TC.
Thank you so much that you have not abandoned the old zip format.

At this time I have not sample code, but I am comparing the two old versions of 7-zip.org (7z912.tar.bz2 from 2010-03-24 and 7z913.tar.bz2 from 2010-04-15, respective from https://sourceforge.net/projects/sevenzip/files/7-Zip/9.12/ and https://sourceforge.net/projects/sevenzip/files/7-Zip/9.13/), because the last one "now stores NTFS file timestamps to ZIP archives".
To see how 7-Zip upgrades the standard zip archives with UTC timestamps, instead of local timestamps.
When I have some extra time and sample code I will write it here.
If someone have other ideas lets talk, lets choose the better way to do it.
Last edited by angel on 2021-12-28, 17:17 UTC, edited 1 time in total.
#381167 Single user license [08:50, 26.10.2022]
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *Dalai »

petermad wrote: 2021-12-27, 22:39 UTC
and I will integrate it into TC
If you do - please make it optional.
Indeed.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
angel
Junior Member
Junior Member
Posts: 46
Joined: 2014-10-17, 06:54 UTC
Location: Sofia, Bulgaria, Europe

Re: Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *angel »

ghisler(Author) wrote: 2021-12-27, 16:07 UTC 2angel
If you (or anyone else) wants me to change the handling of time stamps in zip, just send me some sample code and I will integrate it into TC.
Now I have some extra time and analyzing the code of 7-Zip, especially the "CPP\7zip\Archive\Zip" directory which is equivalent of internal zip in TC (maybe WCMZIP32.DLL and WCMZIP64.DLL).
And I have some thoughts- is it better to integrate that directory (the newest version) in TC and replace (or integrate) the internal zip with her?

The advantages of this scenario are:
1)7-Zip compresses to zip format 2-10% better than most of other zip compatible programs, including paid PKZip and WinZip;
2)AES-256 for zip format;
3)Correct DST and different time zones;

The disadvantage of this scenario is how EASY/FAST to do that? The developer FAQ from https://www.7-zip.org/faq.html says:
-How can I add support for 7z archives to my application?
-One way is to use the 7z.dll or 7za.dll (available from sf.net for download). The 7za.dll works via COM interfaces. It, however, doesn't use standard COM interfaces for creating objects. You can find a small example in "CPP\7zip\UI\Client7z" folder in the source code. A full example is 7-Zip itself, since 7-Zip works via this dll also. There are other applications that use 7za.dll such as WinRAR, PowerArchiver and others.
The other way is to call the command line version: 7za.exe.

What you think?
#381167 Single user license [08:50, 26.10.2022]
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Source code of internal zip packer to fix timestams in UTC, instead of localtime

Post by *ghisler(Author) »

Did you find out whether 7zip sets any flag in the file header when storing times as UTC? Otherwise it would be impossible to know whether a file contains timestamps in local time or UTC.
Author of Total Commander
https://www.ghisler.com
Post Reply