Fixed filetransfer speed calculation

This commit is contained in:
Michiel Broek 2002-06-16 21:15:26 +00:00
parent 4526bfdee9
commit 29687a8502
2 changed files with 10 additions and 4 deletions

View File

@ -28,6 +28,8 @@ v0.35.01 05-Jun-2002
Irex and patched BinkP versions. Irex and patched BinkP versions.
Better error handling for error conditions during a binkp Better error handling for error conditions during a binkp
session. session.
Fixed a problem with the calculated filetransfer speed with
large files on fast connections.
mbfile: mbfile:
Added -v commandline switch to supress virus checking for the Added -v commandline switch to supress virus checking for the

View File

@ -478,15 +478,19 @@ void execute_disposition(file_list *fl)
char *transfertime(struct timeval start, struct timeval end, long bytes, int sent) char *transfertime(struct timeval start, struct timeval end, long bytes, int sent)
{ {
static char resp[81]; static char resp[81];
long startms, endms, elapsed; double long startms, endms, elapsed;
memset(&resp, 0, sizeof(resp));
startms = (start.tv_sec * 1000) + (start.tv_usec / 1000); startms = (start.tv_sec * 1000) + (start.tv_usec / 1000);
endms = (end.tv_sec * 1000) + (end.tv_usec / 1000); endms = (end.tv_sec * 1000) + (end.tv_usec / 1000);
elapsed = endms - startms; elapsed = endms - startms;
memset(&resp, 0, sizeof(resp));
if (!elapsed) if (!elapsed)
elapsed = 1L; elapsed = 1L;
sprintf(resp, "%ld bytes %s in %0.3f seconds (%ld cps)", if (bytes > 1000000)
sprintf(resp, "%ld bytes %s in %0.3Lf seconds (%0.0Lf cps)",
bytes, sent?"sent":"received", elapsed / 1000.000, (bytes / elapsed) * 1000);
else
sprintf(resp, "%ld bytes %s in %0.3Lf seconds (%0.0Lf cps)",
bytes, sent?"sent":"received", elapsed / 1000.000, (bytes * 1000) / elapsed); bytes, sent?"sent":"received", elapsed / 1000.000, (bytes * 1000) / elapsed);
return resp; return resp;
} }