lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev Re: fix HTReadProgress (patch)


From: Leonid Pauzner
Subject: Re: lynx-dev Re: fix HTReadProgress (patch)
Date: Mon, 21 Dec 1998 22:04:53 +0300 (MSK)

>> * In HTReadProgress() use DontCheck() instead of interpolation, more accurate
>>   transfer rate calculation (was problem within a second cyrcle). - LP

> Sorry, with this patch I got a sleep for several seconds while trying
> to scroll in partial_display mode. Will check...

OK, now without DontCheck(),

* Fix HTReadProgress(): more accurate transfer rate calculation. - LP


diff -u old/htalert.c ./htalert.c
--- old/htalert.c       Sat Dec 12 20:10:36 1998
+++ ./htalert.c Mon Dec 21 21:55:26 1998
@@ -96,10 +96,11 @@
     static long kb_units = 1024;
     static time_t first, last;
     static long bytes_last;
-    long transfer_rate, divisor;
+    static long transfer_rate = 0;
+    long divisor;
     char line[80];
     time_t now = time((time_t *)0);  /* once per second */
-    char *units = "bytes";
+    static char *units = "bytes";

     if (bytes == 0) {
        first = last = now;
@@ -107,6 +108,7 @@
     } else if ((bytes > 0) &&
               (now != first))
               /* 1 sec delay for transfer_rate calculation :-( */ {
+       if (transfer_rate <= 0)    /* the very first time */
        transfer_rate = (bytes) / (now - first);   /* bytes/sec */

        /* optimal refresh time: every 0.2 sec */
@@ -117,7 +119,9 @@
            if (now != last) {
                last = now;
                bytes_last = bytes;
+               transfer_rate = (bytes_last) / (last - first); /* more accurate 
here */
            }
+
            units = gettext("bytes");
            divisor = 1;
            if (LYshow_kb_rate



reply via email to

[Prev in Thread] Current Thread [Next in Thread]