From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage-utils:master commit in: man/, /, man/include/
Date: Fri, 29 Mar 2019 16:35:40 +0000 (UTC) [thread overview]
Message-ID: <1553877110.c701892114d5b3eea773ff13f013f4d3a71fa571.grobian@gentoo> (raw)
commit: c701892114d5b3eea773ff13f013f4d3a71fa571
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 29 16:31:50 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Mar 29 16:31:50 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=c7018921
qlop: support standard date output format in parse_date
This allows to cut 'n' paste dates to limit output.
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/include/qlop.optdesc.yaml | 3 +++
man/qlop.1 | 5 ++++-
qlop.c | 14 +++++++++-----
3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/man/include/qlop.optdesc.yaml b/man/include/qlop.optdesc.yaml
index a8fae61..25143b2 100644
--- a/man/include/qlop.optdesc.yaml
+++ b/man/include/qlop.optdesc.yaml
@@ -13,6 +13,9 @@ date: |
.IP YYYY-MM-DD
Big-endian date, with components separated by hyphens, starting with
year, followed by month and day of month.
+ .IP YYYY-MM-DDThh:mm:ss
+ As before, but hours, minutes and seconds added. This is the same
+ format qlop prints for timestamps.
.IP SSSSSSSSS
Seconds since 1970-01-01 00:00:00 +0000 (UTC), the UNIX epoch.
.IP FORMAT|DATE
diff --git a/man/qlop.1 b/man/qlop.1
index 407c9ea..f0ef69a 100644
--- a/man/qlop.1
+++ b/man/qlop.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qlop "1" "Feb 2019" "Gentoo Foundation" "qlop"
+.TH qlop "1" "Mar 2019" "Gentoo Foundation" "qlop"
.SH NAME
qlop \- emerge log analyzer
.SH SYNOPSIS
@@ -89,6 +89,9 @@ Alias for \fI1 day 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 YYYY-MM-DDThh:mm:ss
+As before, but hours, minutes and seconds added. This is the same
+format qlop prints for timestamps.
.IP SSSSSSSSS
Seconds since 1970-01-01 00:00:00 +0000 (UTC), the UNIX epoch.
.IP FORMAT|DATE
diff --git a/qlop.c b/qlop.c
index b6970d0..a87cc5c 100644
--- a/qlop.c
+++ b/qlop.c
@@ -103,17 +103,21 @@ parse_date(const char *sdate, time_t *t)
return false;
} else {
/* Handle automatic formats:
- * - "12315128" -> %s
- * - "2015-12-24" -> %Y-%m-%d
+ * - "12315128" -> %s
+ * - "2015-12-24" -> %Y-%m-%d
+ * - "2019-03-28T13:52:31" -> %Y-%m-%dT%H:%M:%s"
* - human readable format (see below)
*/
- size_t len = strspn(sdate, "0123456789-");
+ size_t len = strspn(sdate, "0123456789-:T");
if (sdate[len] == '\0') {
const char *fmt;
- if (strchr(sdate, '-') == NULL)
+ if (strchr(sdate, '-') == NULL) {
fmt = "%s";
- else
+ } else if ((s = strchr(sdate, 'T')) == NULL) {
fmt = "%Y-%m-%d";
+ } else {
+ fmt = "%Y-%m-%dT%H:%M:%S";
+ }
s = strptime(sdate, fmt, &tm);
if (s == NULL || s[0] != '\0')
next reply other threads:[~2019-03-29 16:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-29 16:35 Fabian Groffen [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-01-30 14:14 [gentoo-commits] proj/portage-utils:master commit in: man/, /, man/include/ Fabian Groffen
2019-12-27 19:16 Fabian Groffen
2019-07-18 18:36 Fabian Groffen
2019-06-09 9:53 Fabian Groffen
2019-05-17 14:35 Fabian Groffen
2019-05-13 13:39 Fabian Groffen
2019-04-28 7:58 Fabian Groffen
2019-03-07 18:20 Fabian Groffen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1553877110.c701892114d5b3eea773ff13f013f4d3a71fa571.grobian@gentoo \
--to=grobian@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox