From 33d4e18b26cd37691a81584da0efd929097a22b3 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Thu, 12 Apr 2018 21:14:19 +0200 Subject: qlop: don't rely on %F for data parsing for portability While at it document the date formats in the man-page. --- man/include/qlop.optdesc.yaml | 16 ++++++++++++++++ man/qlop.1 | 16 +++++++++++++++- qlop.c | 6 +++--- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/man/include/qlop.optdesc.yaml b/man/include/qlop.optdesc.yaml index 7864d6e..fad1670 100644 --- a/man/include/qlop.optdesc.yaml +++ b/man/include/qlop.optdesc.yaml @@ -1,3 +1,19 @@ +date: | + Limit the selection of packages to the date given, or to the range + of dates if this argument is given twice. The \fB--date\fR option + can take a few forms. + .RS + .IP "NUMBER [s] [ago]" + Relative time, specifying \fINUMBER\fR \fIdays\fR, \fIweeks\fR, + \fImonths\fR or \fIyears\fR, for example \fI3 days ago\fR. + .IP YYYY-MM-DD + Big-endian date, with components separated by hyphens, starting with + year, followed by month and day of month. + .IP SSSSSSSSS + Seconds since 1970-01-01 00:00:00 +0000 (UTC), the UNIX epoch. + .IP FORMAT|DATE + Use \fIFORMAT\fR as input for \fBstrptime\fR(3) to parse \fIDATE\fR. + .RE gauge: | Gauge number of times a package has been merged. This shows the merge time for each individual merge of package. diff --git a/man/qlop.1 b/man/qlop.1 index c138054..9c449a9 100644 --- a/man/qlop.1 +++ b/man/qlop.1 @@ -39,7 +39,21 @@ Show current emerging packages. This relies on in order to detect running merges. .TP \fB\-d\fR \fI\fR, \fB\-\-date\fR \fI\fR -Limit selection to this time (1st -d is start, 2nd -d is end). +Limit the selection of packages to the date given, or to the range +of dates if this argument is given twice. The \fB--date\fR option +can take a few forms. +.RS +.IP "NUMBER [s] [ago]" +Relative time, specifying \fINUMBER\fR \fIdays\fR, \fIweeks\fR, +\fImonths\fR or \fIyears\fR, for example \fI3 days ago\fR. +.IP YYYY-MM-DD +Big-endian date, with components separated by hyphens, starting with +year, followed by month and day of month. +.IP SSSSSSSSS +Seconds since 1970-01-01 00:00:00 +0000 (UTC), the UNIX epoch. +.IP FORMAT|DATE +Use \fIFORMAT\fR as input for \fBstrptime\fR(3) to parse \fIDATE\fR. +.RE .TP \fB\-f\fR \fI\fR, \fB\-\-logfile\fR \fI\fR Read emerge logfile instead of $EMERGE_LOG_DIR/emerge.log. diff --git a/qlop.c b/qlop.c index 67669ef..1d4e0d9 100644 --- a/qlop.c +++ b/qlop.c @@ -39,7 +39,7 @@ static const char qlop_desc[] = "The --date option can take a few forms:\n" " -d '# [s] [ago]' (e.g. '3 days ago')\n" "Or using strptime(3) formats:\n" - " -d '2015-12-25' (detected as %F)\n" + " -d '2015-12-25' (detected as %Y-%m-%d)\n" " -d '1459101740' (detected as %s)\n" " -d '%d.%m.%Y|25.12.2015' (format is specified)"; #define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, qlop_desc, lookup_applet_idx("qlop")) @@ -733,7 +733,7 @@ parse_date(const char *sdate, time_t *t) } else { /* Handle automatic formats: * - "12315128" -> %s - * - "2015-12-24" -> %F (same as %Y-%m-%d + * - "2015-12-24" -> %Y-%m-%d * - human readable format (see below) */ size_t len = strspn(sdate, "0123456789-"); @@ -742,7 +742,7 @@ parse_date(const char *sdate, time_t *t) if (strchr(sdate, '-') == NULL) fmt = "%s"; else - fmt = "%F"; + fmt = "%Y-%m-%d"; s = strptime(sdate, fmt, &tm); if (s == NULL || s[0] != '\0') -- cgit v1.2.3-65-gdbad