--[[ File l3build-zip.lua Copyright (C) 2021-2024 The LaTeX Project It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this license or (at your option) any later version. The latest version of this license is in the file https://www.latex-project.org/lppl.txt This file is part of the "l3build bundle" (The Work in LPPL) and all files in that bundle must be distributed together. ----------------------------------------------------------------------- The development version of the bundle can be found at https://github.com/latex3/l3build for those people who are interested. --]] local concat = table.concat local open = io.open local osdate = os.date local pack = string.pack local setmetatable = setmetatable local iotype = io.type local compress = zlib.compress local crc32 = zlib.crc32 local function encode_time(unix) local t = osdate('*t', unix) local date = t.day | (t.month << 5) | ((t.year-1980) << 9) local time = (t.sec//2) | (t.min << 5) | (t.hour << 11) return date, time end local function extra_timestamp(mod, access, creation) local flags = 0 local local_extra, central_extra = '', '' if mod then flags = flags | 0x1 local_extra = pack('= #content then compressed = nil end local timestamp = os.time() local date, time = encode_time(timestamp) local central_extra, local_extra = extra_timestamp(timestamp, nil, nil) z.f:write(pack("