diff options
Diffstat (limited to 'ark/zip.cpp')
| -rw-r--r-- | ark/zip.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ark/zip.cpp b/ark/zip.cpp index b95c7d5..345f772 100644 --- a/ark/zip.cpp +++ b/ark/zip.cpp @@ -40,6 +40,7 @@ // ark includes #include "zip.h" +#include "arkutils.h" #include "arkwidget.h" #include "settings.h" #include "filelistview.h" @@ -324,22 +325,23 @@ bool ZipArch::processLine( const TQCString &line ) return false; } - // unzip-6 can be configured at build time to return date in either of three - // formats: + // unzip can be configured at build time to return date in either of three + // formats (for version 6): // - MM-DD-YYYY (the default on *nix systems) // - DD-MM-YYYY (not used by default) // - YYYY-MM-DD (used in several linux distribution e.g. debian) // Unfortunately there is no easy way to query unzip which format it does // use, so we will have to guestimate here. Also since the DMY is not widely // used and in general case indistinguishable from MDY we will ignore it and - // concentrate on distinguishing between MDY and YMD. Luckily unzip-6 unlike - // unzip-5 uses 4 digits for years, so it will be relatively painless. + // concentrate on distinguishing between MDY and YMD. Luckily unzip-6 uses + // 4 digits for years, so it will be relatively painless. On the other hand + // unzip-5 uses 2-digits for a year, so in that case always assume MDY. TQString date = lineRx.cap(5); TQString time = lineRx.cap(6); - TQRegExp mdyDateRx{"^([01][0-9])-([0-3][0-9])-([0-9]{4,})$"}; + TQRegExp mdyDateRx{"^([01][0-9])-([0-3][0-9])-([0-9]{2,})$"}; if(mdyDateRx.search(date) != -1) { - date = mdyDateRx.cap(3) + "-" + mdyDateRx.cap(1) + "-" + mdyDateRx.cap(2); + date = ArkUtils::fixYear(mdyDateRx.cap(3)) + "-" + mdyDateRx.cap(1) + "-" + mdyDateRx.cap(2); } TQString timestamp = date + " " + time; |
