Add time_until() and time_since() utility functions
Adding these in preparation for converting server->connect_time from time_t to struct timeval. Also converts three existing open-coded versions over to the new functions.
This commit is contained in:
@@ -1617,7 +1617,7 @@ char lame_type[30];
|
||||
strcpy(lame_type, "T");
|
||||
strcat(lame_type, dcc_types[type]->name);
|
||||
|
||||
xtime = BX_time_diff(n->starttime, get_time(NULL));
|
||||
xtime = time_since(&n->starttime);
|
||||
xfer = (double)(n->bytes_sent ? n->bytes_sent : n->bytes_read);
|
||||
|
||||
if (xfer == 0.0)
|
||||
@@ -2884,7 +2884,7 @@ DCC_int *n;
|
||||
return;
|
||||
dcc_bytes_in += n->bytes_read;
|
||||
dcc_bytes_out += n->bytes_sent;
|
||||
xtime = BX_time_diff(n->starttime, get_time(NULL));
|
||||
xtime = time_since(&n->starttime);
|
||||
|
||||
if (xtime <= 0)
|
||||
xtime = 1;
|
||||
|
||||
Reference in New Issue
Block a user