On Saturday, May 7, 2005 at 6:56:53 PM +0200, Hrvoje Niksic wrote:

> I was lead to believe that it is quite reasonable to set tm_isdst to
> zero before calling mktime. In fact, the logic in mktime_from_utc,
> along with setting tm_isdst to zero, was explicitly written to support
> discontinuities at DST transition points -- see Roger Beeman's
> changelog entry from 2001-04-25.

And comments in code, which are very detailed, thanks. Is behaviour of
mktime() with limit false input values defined in standards? What about
another method: putenv(TZ=GMT0), tzset(), mktime(), reset TZ to previous
state, tzset() again. Not portable?


> Fortunately there is an easy solution for this: simply #undef
> HAVE_MKTIME in config.h. This will enable the use of Wget's mktime
> replacement that comes from glibc 2 and does not have the bug.

This gives a minus one hour error during 2 hours (3:00:00-4:59:59):

| $ TZ=GMT0 vdir --full-time /var/www/testfile[34]
| -rw-r--r--   1 root     root            0 Sun Mar 26 03:30:00 2000 
/var/www/testfile3
| -rw-r--r--   1 root     root            0 Sun Mar 26 04:30:00 2000 
/var/www/testfile4
| $ TZ=GMT0 vdir --full-time /tmp/testfile[34]
| -rw-r--r--   1 ag       users           0 Sun Mar 26 02:30:00 2000 
/tmp/testfile3
| -rw-r--r--   1 ag       users           0 Sun Mar 26 03:30:00 2000 
/tmp/testfile4

Tried same #undefs on Woody: testfile3 gets same wrong 2:30 GMT
timestamp, while testfile4 gets the current date (9 May 2005).


BTW unrelated I tried building alpha-3 on another machine with more or
less same Debian Bo setup, and got this error:

| gcc -I. -I. -I/opt/include   -DHAVE_CONFIG_H 
-DSYSTEM_WGETRC=\"/usr/local/etc/wgetrc\" 
-DLOCALEDIR=\"/usr/local/share/locale\" -O2 -Wall -Wno-implicit -c init.c
| init.c:214: structure has no member named `random_file'
| init.c:214: initializer element for `commands[76].place' is not constant
| make[1]: *** [init.o] Error 1
| make[1]: Leaving directory `/tmp/wget-1.10-alpha3/src'
| make: *** [src] Error 2


Alain.

Reply via email to