This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: mktime + UTC problem
- From: Paul Eggert <eggert at CS dot UCLA dot EDU>
- To: Daniel Drake <ddrake at brontes3d dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 06 Nov 2006 09:58:48 -0800
- Subject: Re: mktime + UTC problem
- References: <1162821647.568.33.camel@systems03.lan.brontes3d.com>
Daniel Drake <ddrake@brontes3d.com> writes:
> if I change:
>
> setenv("TZ", "", 1);
>
> to:
>
> setenv("TZ", "GMT0", 1);
>
> then the test program produces the expected results.
mktime doesn't care about TZ directly; it gets its data via localtime
and gmtime. So I suspect that you can reproduce the bug by using only
localtime as well. You can verify this by debugging mktime,
inspecting every time it calls localtime and/or gmtime, and checking
the results of these calls. If my guess is right, you can then look
for the actual bug (either within localtime, or within your system
setup). If my guess is wrong, please let us know the sequence of
calls to localtime/gmtime and what they return.
One thing that strikes me is that within glibc, TZ="" is equivalent to
TZ="Universal". Perhaps the file /usr/share/zoneinfo/Universal is
corrupted on your troublesome system? That would explain it right
there.