fix: wrong timestamp inside zip
Massimo Melina committed
May 25, 2022 at 10:36 UTC
21e529db177838064daf6a1279942d7c2e7a91db
1 file changed
+2
-2
server/src/QuickZipStream.ts
+2
-2
@@ -224,8 +224,8 @@ function buffer(parts: any[]) {
224
}
225
226
function ts2buf(ts:Date) {
227
- const date = (ts.getFullYear() - 1980) << 9 | ts.getMonth() << 5 | ts.getDate()
228
- const time = ts.getHours() << 11 | ts.getMinutes() << 5 | ts.getSeconds()
227
+ const date = ((ts.getFullYear() - 1980) & 0x7F) << 9 | (ts.getMonth() + 1) << 5 | ts.getDate()
228
+ const time = ts.getHours() << 11 | ts.getMinutes() << 5 | (ts.getSeconds() / 2) & 0x0F
229
return [
230
2, time,
231
2, date,