aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>1997-11-26 02:16:10 +0000
committerBrian Somers <brian@FreeBSD.org>1997-11-26 02:16:10 +0000
commitfc85e494d062a3435382180e70d1bd3e408532af (patch)
treef776c9f11075ad10a8aac59370cd6c7738904ddd /usr.sbin
parentb50a9aa790a02885d628c253fe7e451174029e54 (diff)
downloadsrc-fc85e494d062a3435382180e70d1bd3e408532af.tar.gz
src-fc85e494d062a3435382180e70d1bd3e408532af.zip
Display connect time as 0 if we've never been
connected. Pointed out by: Jeff Kletsky <Jeff@wagsky.com>
Notes
Notes: svn path=/head/; revision=31418
Diffstat (limited to 'usr.sbin')
-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 d7354f1be679..e53aa00143e1 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/18 14:52:07 brian Exp $
+ * $Id: throughput.c,v 1.2 1997/11/22 03:37:52 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);