On Monday, May 9, 2005 at 5:53:26 PM +0200, Hrvoje Niksic wrote:

> Alain Guibert <[EMAIL PROTECTED]> writes:
>> What about another method: putenv(TZ=GMT0), tzset(), mktime(), reset
>> TZ to previous state, tzset() again. Not portable?
> That sounds at least as non-portable as the current method, and it
> might be slow in addition. Have you tried that method? Does it help
> in your case?

    It seems to work correctly on Linux and Cygwin, and is roughly 3
times faster. I tried this:

| static time_t
| mktime_from_utc (struct tm *t)
| {
|   time_t time;
|   char *tz;
|   char save_tz[100];
|
|   tz=getenv("TZ");
|   if (tz)
|     strncpy(save_tz, tz, sizeof(save_tz));
|   setenv("TZ", "GMT0", 1);
|   tzset();
|   time=mktime(t);
|   if (tz)
|     setenv("TZ", save_tz, 1);
|   else
|     unsetenv("TZ");
|   tzset();
|   return (time);
| }

But I'm sure it will fail on some platforms, so not good.


> I find it strange that the cmpt.c mktime produces garbage when that
> version is taken from glibc.

Note that with TZ=GMT0 method and #undef HAVE_MKTIME, wget gives correct
timestamps. Maybe cmpt.c mktime is failing because of incompatible
timezone and daylight infos on the platform? It calls __tzset() but does
not provide it.


>>| init.c:214: structure has no member named `random_file'
>>| init.c:214: initializer element for `commands[76].place' is not constant
> This has been fixed in CVS; the fix is to wrap the offending init.c
> line in #ifdef HAVE_SSL.

That's it, thank you!


Alain.

Reply via email to