dylex / zip-stream

Haskell ZIP archive streaming processing using conduit
BSD 3-Clause "New" or "Revised" License
7 stars 8 forks source link

Roundtrip packing/unpacking introduces offset of exactly 46751 days #1

Closed gkleen closed 6 years ago

dylex commented 6 years ago

That sounds like 128 years, which is exactly the precision that the zip file format supports -- it represents the year in 7 bits, so only supports years between 1980 and 2107. Blame DOS for this, but even the latest zip standard (6.3.4) still uses it. Sorry.

There is a defined "UNIX" extension that allows additional 4-byte mtime/atime fields, but the zip programs I've tried don't support it, and it basically has the same range (1970-2106) anyway.

gkleen commented 6 years ago

You're right, by random chance none of the dates in my testset happened to be in the supported range.

Constraining myself to that range makes roundtrip encoding/decoding work fine without compensating for any offset.

Thank you!