1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-30 06:01:00 +01: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

View file

@ -35,7 +35,7 @@ struct ZipInputAccessor : InputAccessor
: zipPath(_zipPath)
{
int error;
zipFile = zip_open(zipPath.c_str(), 0, &error);
zipFile = zip_open(zipPath.c_str(), ZIP_RDONLY, &error);
if (!zipFile) {
char errorMsg[1024];
zip_error_to_str(errorMsg, sizeof errorMsg, error, errno);
@ -68,16 +68,6 @@ struct ZipInputAccessor : InputAccessor
if (!slash) continue;
members.emplace(slash, sb);
}
#if 0
/* Sigh, libzip returns a local time, so convert to Unix
time. */
if (lastModified) {
struct tm tm;
localtime_r(&lastModified, &tm);
lastModified = timegm(&tm);
}
#endif
}
~ZipInputAccessor()