aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-04-18 02:34:29 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-04-18 02:38:32 +0200
commit5598bdf0d3d46a865a4d23785e2d09e6db9be420 (patch)
treeedae478a1b025b0aee5a9a165f180da7dc4f18f0
parent07bd9799217038391c8d299e6a2e031fef23c20b (diff)
downloadbusybox-5598bdf0d3d46a865a4d23785e2d09e6db9be420.tar.gz
unzip: shorter code for date/time generation
function old new delta unzip_main 2426 2414 -12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/unzip.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/archival/unzip.c b/archival/unzip.c
index a7532e0ff..be32e60e2 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -642,14 +642,14 @@ int unzip_main(int argc, char **argv)
} else {
if (listing) {
/* List entry */
- unsigned dostime = zip_header.formatted.modtime | (zip_header.formatted.moddate << 16);
char dtbuf[sizeof("mm-dd-yyyy hh:mm")];
sprintf(dtbuf, "%02u-%02u-%04u %02u:%02u",
- (dostime & 0x01e00000) >> 21,
- (dostime & 0x001f0000) >> 16,
- ((dostime & 0xfe000000) >> 25) + 1980,
- (dostime & 0x0000f800) >> 11,
- (dostime & 0x000007e0) >> 5
+ (zip_header.formatted.moddate >> 5) & 0xf, // mm: 0x01e0
+ (zip_header.formatted.moddate) & 0x1f, // dd: 0x001f
+ (zip_header.formatted.moddate >> 9) + 1980, // yy: 0xfe00
+ (zip_header.formatted.modtime >> 11), // hh: 0xf800
+ (zip_header.formatted.modtime >> 5) & 0x3f // mm: 0x07e0
+ // seconds/2 are not shown, encoded in ----------- 0x001f
);
if (!verbose) {
// " Length Date Time Name\n"