aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2019-02-26 09:35:01 +0100
committerFabian Groffen <grobian@gentoo.org>2019-02-27 21:50:10 +0100
commitb7b0034258f1a378cc3902b238bffdaca001d0f5 (patch)
treec64b96ad5cb983b9609c687df648560b3a5ae8cb
parentxarray: improve malloc efficiency, allow removing elements (diff)
downloadportage-utils-b7b0034258f1a378cc3902b238bffdaca001d0f5.tar.gz
portage-utils-b7b0034258f1a378cc3902b238bffdaca001d0f5.tar.bz2
portage-utils-b7b0034258f1a378cc3902b238bffdaca001d0f5.zip
qcache: move print_seconds_for_earthlings here
qcache currently is the only consumer of this function Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r--qcache.c17
1 files changed, 16 insertions, 1 deletions
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 - <tcort@gentoo.org>
@@ -678,6 +678,21 @@ qcache_dropped(qcache_data *data)
}
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)
{
static time_t runtime;