diff options
author | 1996-06-17 01:36:01 +0000 | |
---|---|---|
committer | 1996-06-17 01:36:01 +0000 | |
commit | 74535063155eb0f5e438c6866dc62362aae69f17 (patch) | |
tree | 825d9f5c8fbfc3493f62793bd98cbbeaba2871f3 | |
parent | 68060 support == 68040 support (diff) | |
download | wireguard-openbsd-74535063155eb0f5e438c6866dc62362aae69f17.tar.xz wireguard-openbsd-74535063155eb0f5e438c6866dc62362aae69f17.zip |
print days correct; also deal with today correctly, netbsd pr#2534, tacha@tera.fukui-med.ac.jp
-rw-r--r-- | usr.bin/w/pr_time.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/w/pr_time.c b/usr.bin/w/pr_time.c index 86b5a40a649..c126969a265 100644 --- a/usr.bin/w/pr_time.c +++ b/usr.bin/w/pr_time.c @@ -59,7 +59,9 @@ pr_attime(started, now) struct tm *tp; time_t diff; char fmt[20]; + int today; + today = localtime(now)->tm_yday; tp = localtime(started); diff = *now - *started; @@ -68,7 +70,7 @@ pr_attime(started, now) (void)strcpy(fmt, "%d%b%y"); /* If not today, use day-hour-am/pm. */ - else if (*now / SECSPERDAY != *started / SECSPERDAY) { + else if (tp->tm_yday != today ) { (void)strcpy(fmt, __CONCAT("%a%", "I%p")); } @@ -91,8 +93,7 @@ pr_idle(idle) { /* If idle more than 36 hours, print as a number of days. */ if (idle >= 36 * SECSPERHOUR) - (void)printf(" %dday%c ", idle / SECSPERDAY, - idle >= 24 * SECSPERHOUR ? 's' : ' '); + printf(days == 1 ? " %dday " : " %ddays ", days); /* If idle more than an hour, print as HH:MM. */ else if (idle >= SECSPERHOUR) |