summaryrefslogtreecommitdiff
path: root/usr.bin/w
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-13 17:24:51 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-13 17:24:51 +0000
commitb3f5966913f84d23e61812b0cc03cb9d97945a07 (patch)
treef7b593d1dd6bc2af39f5561a4f39076de6a3ccaf /usr.bin/w
parent9cc8ce8112bb53f466806c7d42e44c100932895f (diff)
handle >9 days
Diffstat (limited to 'usr.bin/w')
-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)