bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] Query about correcting for DST with Wget


From: Tim Ruehsen
Subject: Re: [Bug-wget] Query about correcting for DST with Wget
Date: Mon, 14 Nov 2016 17:10:23 +0100
User-agent: KMail/5.2.3 (Linux/4.8.0-1-amd64; KDE/5.27.0; x86_64; ; )

On Sunday, November 13, 2016 7:10:57 PM CET Jernej Simončič wrote:
> On Friday, November 11, 2016, 8:52:49, Eli Zaretskii wrote:
> > Can you tell more details, like the exact URL you downloaded and how
> > you see the 1-hour difference?  I'd like to try to reproduce this
> > here.
> 
> I'm not sure if this is a problem with wget, Windows or the server
> hosting the file, but I observed this happening with
> <https://live.sysinternals.com/procexp.exe> - while DST is in effect,
> the file gets timestamp of 22:19, and when it's not it's 23:19 (I'm in
> the CET timezone).

Just tested on Debian, the file time on the filesystem after download is 23:19, 
no matter is DST or not. Since I am on CET, that is the correct time (server 
says "Thu, 04 Feb 2016 22:19:14 GMT".

Now, looking at the code in src/http.c/http_atotm()...

struct tm t;
setlocale (LC_TIME, "C");
strptime ("Thu, 04 Feb 2016 22:19:14 GMT", "%a, %d %b %Y %T", &t);
return timegm (&t);


strptime and timegm are covered by gnulib (please check, that your 
bootstrap.conf contains these two modules). But it lacks 'setlocale'.

What you could try is (in DST where the timeshift occurs):

1. add 'setlocale' to the bootstrap.conf (and ./bootstrap + ./configure + make 
clean + make). And see if the problem persists.

 If it does... 
2. add a printf to src/http.c/http_atotm() to print out the time_t value - it 
should be the same in DST and outside DST.

3. If the time_t value differs, try without the setlocale code (comment the 
line with setlocale (LC_TIME, "C");).

4. if the time_t value still differs, maybe the struct tm t becomes filled with 
wrong values, e.g. tm_isdst field is set in DST. Try setting t.tm_isdst to 0 
before calling timegm().

Somewhere here you should be able to pinpoint the problem. Maybe searching the 
web helps, the problem should be known. Once we know it, we can fix it in wget 
- but in the long term it should go into gnulib (if it is not the missing 
'setlocale' module in bootstrap.conf).

Regards, Tim

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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