diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-07-06 02:28:56 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-07-06 02:28:56 +0000 |
commit | a392bf7c2557809c971d9fcc9e2dd5dbd7665470 (patch) | |
tree | dacd84ef5e5571041007c606a756b57855111ba5 | |
parent | 2b00dfd567c7573cd93695c4c75a086b053b1d9d (diff) |
Fix output format for machines up/down > 99 days.
From Janjaap van Velthooven <janjaap@stack.nl>
-rw-r--r-- | usr.bin/ruptime/ruptime.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/ruptime/ruptime.c b/usr.bin/ruptime/ruptime.c index b2000bc8fa3..922a7c49d76 100644 --- a/usr.bin/ruptime/ruptime.c +++ b/usr.bin/ruptime/ruptime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ruptime.c,v 1.4 1997/06/20 09:59:27 deraadt Exp $ */ +/* $OpenBSD: ruptime.c,v 1.5 1997/07/06 02:28:55 millert Exp $ */ /* * Copyright (c) 1983 The Regents of the University of California. @@ -41,7 +41,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)ruptime.c 5.8 (Berkeley) 7/21/90";*/ -static char rcsid[] = "$OpenBSD: ruptime.c,v 1.4 1997/06/20 09:59:27 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ruptime.c,v 1.5 1997/07/06 02:28:55 millert Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -189,18 +189,18 @@ interval(tval, updown) static char resbuf[32]; int days, hours, minutes; - if (tval < 0 || tval > 365*24*60*60) { - (void)sprintf(resbuf, " %s ??:??", updown); + if (tval < 0 || tval > 999*24*60*60) { + (void)sprintf(resbuf, "%s ??:??", updown); return(resbuf); } minutes = (tval + 59) / 60; /* round to minutes */ hours = minutes / 60; minutes %= 60; days = hours / 24; hours %= 24; if (days) - (void)sprintf(resbuf, "%s %2d+%02d:%02d", + (void)sprintf(resbuf, "%s %3d+%02d:%02d", updown, days, hours, minutes); else - (void)sprintf(resbuf, "%s %2d:%02d", + (void)sprintf(resbuf, "%s %2d:%02d", updown, hours, minutes); return(resbuf); } |