1 |
commit: b7b0034258f1a378cc3902b238bffdaca001d0f5 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Feb 26 08:35:01 2019 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 27 20:50:10 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=b7b00342 |
7 |
|
8 |
qcache: move print_seconds_for_earthlings here |
9 |
|
10 |
qcache currently is the only consumer of this function |
11 |
|
12 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
13 |
|
14 |
qcache.c | 17 ++++++++++++++++- |
15 |
1 file changed, 16 insertions(+), 1 deletion(-) |
16 |
|
17 |
diff --git a/qcache.c b/qcache.c |
18 |
index a3be446..831af2e 100644 |
19 |
--- a/qcache.c |
20 |
+++ b/qcache.c |
21 |
@@ -1,5 +1,5 @@ |
22 |
/* |
23 |
- * Copyright 2005-2018 Gentoo Foundation |
24 |
+ * Copyright 2005-2019 Gentoo Foundation |
25 |
* Distributed under the terms of the GNU General Public License v2 |
26 |
* |
27 |
* Copyright 2006 Thomas A. Cort - <tcort@g.o> |
28 |
@@ -677,6 +677,21 @@ qcache_dropped(qcache_data *data) |
29 |
free(keywords); |
30 |
} |
31 |
|
32 |
+static void |
33 |
+print_seconds_for_earthlings(const unsigned long t) |
34 |
+{ |
35 |
+ unsigned dd, hh, mm, ss; |
36 |
+ unsigned long tt = t; |
37 |
+ ss = tt % 60; tt /= 60; |
38 |
+ mm = tt % 60; tt /= 60; |
39 |
+ hh = tt % 24; tt /= 24; |
40 |
+ dd = tt; |
41 |
+ if (dd) printf("%s%u%s day%s, ", GREEN, dd, NORM, (dd == 1 ? "" : "s")); |
42 |
+ if (hh) printf("%s%u%s hour%s, ", GREEN, hh, NORM, (hh == 1 ? "" : "s")); |
43 |
+ if (mm) printf("%s%u%s minute%s, ", GREEN, mm, NORM, (mm == 1 ? "" : "s")); |
44 |
+ printf("%s%u%s second%s", GREEN, ss, NORM, (ss == 1 ? "" : "s")); |
45 |
+} |
46 |
+ |
47 |
static void |
48 |
qcache_stats(qcache_data *data) |
49 |
{ |