From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 20C18138334 for ; Fri, 29 Mar 2019 16:35:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0078DE08F6; Fri, 29 Mar 2019 16:35:45 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BF831E08F6 for ; Fri, 29 Mar 2019 16:35:44 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1DA46335C9F for ; Fri, 29 Mar 2019 16:35:42 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6EEA054A for ; Fri, 29 Mar 2019 16:35:40 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1553877110.c701892114d5b3eea773ff13f013f4d3a71fa571.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: man/, /, man/include/ X-VCS-Repository: proj/portage-utils X-VCS-Files: man/include/qlop.optdesc.yaml man/qlop.1 qlop.c X-VCS-Directories: man/include/ / man/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: c701892114d5b3eea773ff13f013f4d3a71fa571 X-VCS-Branch: master Date: Fri, 29 Mar 2019 16:35:40 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 8cdc6485-2374-4f08-981b-3215e193b64f X-Archives-Hash: e5fc178931395d081846ccec397554ff commit: c701892114d5b3eea773ff13f013f4d3a71fa571 Author: Fabian Groffen gentoo org> AuthorDate: Fri Mar 29 16:31:50 2019 +0000 Commit: Fabian Groffen gentoo 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 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')