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 479A913858A for ; Wed, 27 Feb 2019 20:53:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1FFE2E0930; Wed, 27 Feb 2019 20:53:42 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 EECC7E0930 for ; Wed, 27 Feb 2019 20:53:41 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (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 8F820335D07 for ; Wed, 27 Feb 2019 20:53:40 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B7ED4545 for ; Wed, 27 Feb 2019 20:53:38 +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: <1551300610.b7b0034258f1a378cc3902b238bffdaca001d0f5.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qcache.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: b7b0034258f1a378cc3902b238bffdaca001d0f5 X-VCS-Branch: master Date: Wed, 27 Feb 2019 20:53:38 +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: 9f9265e6-a6b7-4d41-8d6d-23e23914fe67 X-Archives-Hash: d98db63589d2cdd8c5edaba1d0823b9d commit: b7b0034258f1a378cc3902b238bffdaca001d0f5 Author: Fabian Groffen gentoo org> AuthorDate: Tue Feb 26 08:35:01 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Wed Feb 27 20:50:10 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=b7b00342 qcache: move print_seconds_for_earthlings here qcache currently is the only consumer of this function Signed-off-by: Fabian Groffen gentoo.org> qcache.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/qcache.c b/qcache.c index a3be446..831af2e 100644 --- a/qcache.c +++ b/qcache.c @@ -1,5 +1,5 @@ /* - * Copyright 2005-2018 Gentoo Foundation + * Copyright 2005-2019 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 * * Copyright 2006 Thomas A. Cort - @@ -677,6 +677,21 @@ qcache_dropped(qcache_data *data) free(keywords); } +static void +print_seconds_for_earthlings(const unsigned long t) +{ + unsigned dd, hh, mm, ss; + unsigned long tt = t; + ss = tt % 60; tt /= 60; + mm = tt % 60; tt /= 60; + hh = tt % 24; tt /= 24; + dd = tt; + if (dd) printf("%s%u%s day%s, ", GREEN, dd, NORM, (dd == 1 ? "" : "s")); + if (hh) printf("%s%u%s hour%s, ", GREEN, hh, NORM, (hh == 1 ? "" : "s")); + if (mm) printf("%s%u%s minute%s, ", GREEN, mm, NORM, (mm == 1 ? "" : "s")); + printf("%s%u%s second%s", GREEN, ss, NORM, (ss == 1 ? "" : "s")); +} + static void qcache_stats(qcache_data *data) {