4 ms·
The oddest part of the zip format to me is the msdos time encoding. It is pretty unpopular today though (at least on Google) because it took me a while to find
by eatonphil 5y ago
The oddest part of the zip format to me is the msdos time encoding. It is pretty unpopular today though (at least on Google) because it took me a while to find an explanation of it with code [0] when I was doing an educational project recently on building a zip reader from scratch. But I assume it was a more popular encoding at the time zip was designed.
[0] https://groups.google.com/g/comp.os.msdos.programmer/c/ffAVUFN2NbA https://groups.google.com/g/comp.os.msdos.programmer/c/ffAVU...
- donio 5y agoIt was the easiest to do since that's the format used by the DOS API calls for getting and setting the mtime.
- barosl 5y ago> Since the lower four bits are /2 Wow, so the second field of every timestamp in a ZIP file must be an even number? That's shocking to me! It seems that RAR and FAT32 share this problem. How could I not know this?
- mappu 5y agoFAT32 timestamps are also stored as local time instead of UTC, so there's no way to know a real mtime at all, unless you have out-of-band knowledge. Just nonsense all round - - by modern standards. The really impressive thing is that our industry has managed to paper over most relics from The Olden Days to the point where this discovery is surprising!
- aidenn0 5y agoYou've clearly never rsync'd data to FAT before...
- lifthrasiir 5y agoBecause there are several extensions (extra fields) to ZIP that record the full modified date in addition to creation and access date if the OS supports them.
- palsecam 5y agoAnother explication with (JS) code of the MS-DOS datetime encoding is at https://github.com/PaulCapron/pwa2uwp/blob/79ae42ea43e98eaf9db6ad4bc4059e8c0f31b18d/src/zip.js#L52 https://github.com/PaulCapron/pwa2uwp/blob/79ae42ea43e98eaf9... https://github.com/PaulCapron/pwa2uwp/blob/master/src/zip.js https://github.com/PaulCapron/pwa2uwp/blob/master/src/zip.js in its entirety provides a simple intro, with code, to the ZIP format (archiving only, with no compression)