1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 19:03:16 +02:00

Patch libzip to return timestamps in the Unix epoch

We're not even using those timestamps, but doing the conversion to
local time takes a lot of time. For instance, this patch speeds up
'nix flake metadata nixpkgs` from 0.542s to 0.094s.
This commit is contained in:
Eelco Dolstra 2022-10-10 17:23:24 +02:00
parent 0286edb588
commit 1483c56582
3 changed files with 21 additions and 11 deletions

19
libzip-unix-time.patch Normal file
View file

@ -0,0 +1,19 @@
commit 26e8c76ca84999fa5c0e46a9fc3aa7de80be2e9c
Author: Eelco Dolstra <edolstra@gmail.com>
Date: Mon Oct 10 17:12:47 2022 +0200
Return time_t in the Unix epoch
diff --git a/lib/zip_dirent.c b/lib/zip_dirent.c
index 7fd2f7ce..5c050b4c 100644
--- a/lib/zip_dirent.c
+++ b/lib/zip_dirent.c
@@ -1018,7 +1018,7 @@ _zip_d2u_time(zip_uint16_t dtime, zip_uint16_t ddate) {
tm.tm_min = (dtime >> 5) & 63;
tm.tm_sec = (dtime << 1) & 62;
- return mktime(&tm);
+ return timegm(&tm);
}