summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1996-07-13 17:24:50 +0000
committerderaadt <deraadt@openbsd.org>1996-07-13 17:24:50 +0000
commit3c9254cc04fabac7c6632b6747573603ec589507 (patch)
tree947231ab8becc6e668ffb23935fc57e501ee58a9
parentprint flag options at top, nicer (diff)
downloadwireguard-openbsd-3c9254cc04fabac7c6632b6747573603ec589507.tar.xz
wireguard-openbsd-3c9254cc04fabac7c6632b6747573603ec589507.zip
handle >9 days
-rw-r--r--usr.bin/w/pr_time.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/w/pr_time.c b/usr.bin/w/pr_time.c
index e1625c64351..30eecdf9c8e 100644
--- a/usr.bin/w/pr_time.c
+++ b/usr.bin/w/pr_time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pr_time.c,v 1.6 1996/06/26 05:42:43 deraadt Exp $ */
+/* $OpenBSD: pr_time.c,v 1.7 1996/07/13 17:24:50 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -96,8 +96,14 @@ pr_idle(idle)
int days = idle / SECSPERDAY;
/* If idle more than 36 hours, print as a number of days. */
- if (idle >= 36 * SECSPERHOUR)
- printf(days == 1 ? " %dday " : " %ddays ", days);
+ if (idle >= 36 * SECSPERHOUR) {
+ if (days == 1)
+ printf(" %dday ", days);
+ else if (days < 10)
+ printf(" %ddays ", days);
+ else
+ printf("%ddays ", days);
+ }
/* If idle more than an hour, print as HH:MM. */
else if (idle >= SECSPERHOUR)