summaryrefslogtreecommitdiff
path: root/usr.sbin/ppp/throughput.c
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>1997-12-06 12:08:51 +0000
committerbrian <brian@cvs.openbsd.org>1997-12-06 12:08:51 +0000
commit9ef3183b8c281abdc7ae28af8d33d1020aaf75f6 (patch)
treeae5a2deeb8152f025f9330e4fcc8c8decf9848a4 /usr.sbin/ppp/throughput.c
parent396628eff2a0197613b7f154c089da9d343e298f (diff)
Show uptime as zero if a connection has never been made.
Diffstat (limited to 'usr.sbin/ppp/throughput.c')
-rw-r--r--usr.sbin/ppp/throughput.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/ppp/throughput.c b/usr.sbin/ppp/throughput.c
index da0311fb2d9..169452d1e7e 100644
--- a/usr.sbin/ppp/throughput.c
+++ b/usr.sbin/ppp/throughput.c
@@ -1,5 +1,5 @@
/*
- * $Id: throughput.c,v 1.1 1997/11/23 20:27:37 brian Exp $
+ * $Id: throughput.c,v 1.2 1997/12/06 12:08:50 brian Exp $
*/
#include <sys/param.h>
@@ -34,7 +34,7 @@ throughput_disp(struct pppThroughput *t, FILE *f)
{
int secs_up;
- secs_up = time(NULL) - t->uptime;
+ secs_up = t->uptime ? time(NULL) - t->uptime : 0;
fprintf(f, "Connect time: %d secs\n", secs_up);
if (secs_up == 0)
secs_up = 1;
@@ -55,7 +55,7 @@ throughput_log(struct pppThroughput *t, int level, const char *title)
if (t->uptime) {
int secs_up;
- secs_up = time(NULL) - t->uptime;
+ secs_up = t->uptime ? time(NULL) - t->uptime : 0;
if (title)
LogPrintf(level, "%s: Connect time: %d secs: %ld octets in, %ld octets"
" out\n", title, secs_up, t->OctetsIn, t->OctetsOut);