Re: Bug in ETA code on x64

2006-04-03 Thread Thomas Braby


- Original Message -
From: Hrvoje Niksic <[EMAIL PROTECTED]>
Date: Tuesday, March 28, 2006 7:23 pm

> > in progress.c line 880:
> >
> >eta_hrs = (int)(eta / 3600, eta %= 3600);
> >eta_min = (int)(eta / 60, eta %= 60);
> >eta_sec = (int)(eta);
> 
> This is weird.  Did you compile the code yourself, or did you get it

Yes that is strange. I got the code from one of the GNU mirrors, but 
I'm afraid I can't remember which one.

> from a Windows download site?  I'm asking because the code in
> progress.c doesn't look like that; it in fact looks like this:
> 
>  eta_hrs = eta / 3600, eta %= 3600;
>  eta_min = eta / 60,   eta %= 60;
>  eta_sec = eta;
> 
> The cast to int looks like someone was trying to remove a warning and
> botched operator precedence in the process.  If you must insert the
> cast, try:
> 
> eta_hrs = (int) (eta / 3600), eta %= 3600;

Yes that also works. The cast is needed on Windows x64 because eta is 
a wgint (which is 64-bit) but a regular int is 32-bit so otherwise a 
warning is issued. Oh well. Perhaps it would be better changed to use 
a semicolon for clarity anyway?

cheers,


Bug in ETA code on x64

2006-03-28 Thread Thomas Braby
Hello,

With wget 1.10.2 compiled using Visual Studio 2005 for Windows XP x64 
I was getting no ETA until late in the transfer, when I'd get things 
like:

49:49:49 then 48:48:48 then 47:47:47 etc.

So I checked the eta value in seconds and it was correct, so the code 
in progress.c line 880:

   eta_hrs = (int)(eta / 3600, eta %= 3600);
   eta_min = (int)(eta / 60, eta %= 60);
   eta_sec = (int)(eta);

was what was causing problems. I fixed this by changing it to the 
following.

  eta_hrs = (int)(eta / 3600);
  eta %= 3600;
  eta_min = (int)(eta / 60);
  eta %= 60;
  eta_sec = (int)(eta);

I had also tried making eta_hrs, eta_min and eta_sec a wgint (which is 
an __int64 on my system) but that didn't help.

cheers,