From b33602afc4bdb15ed8eb5868a0d31086cd8c9152 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tom=C3=A1=C5=A1=20Brada?= Date: Sun, 25 Oct 2015 17:42:29 +0100 Subject: [PATCH] Clean timing in Download. --- Download.pas | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Download.pas b/Download.pas index 02e63a9..3f30181 100644 --- a/Download.pas +++ b/Download.pas @@ -80,6 +80,7 @@ procedure tAggr.MsgDATA(sz:Word; mark:byte); var r:tMemoryStream; var rateb: DWord; {BytesPerSecond shr 6 (=64)} var buf:array [1..6] of byte; + var delta:tMTime; begin if mark<>PrvMark then begin if mark<>CurMark then begin @@ -92,10 +93,11 @@ procedure tAggr.MsgDATA(sz:Word; mark:byte); inc(DgrCntCheck); end; if DgrCnt<8 then exit; - if (mnow-Startt)<400 then exit; - rate:=(ByteCnt/(mNow-StartT))*1000; - writeln('Rate: ',(rate/1024):7:1); - rateb:=round(rate/64); + delta:=(mNow-StartT){*MSecsPerDay}; + if delta<400 then exit; + rate:=(ByteCnt/delta)*1000; + writeln('Rate: ',(rate/1024):7:1, '(',ByteCnt,')'); + rateb:=round((rate)/64); StartT:=mNow; ByteCnt:=1; r.Init(@buf,0,sizeof(buf)); -- 2.11.4.GIT