On 12/13/2009 06:47 PM, Kumar Appaiah wrote:
When we're sure relevant libraries are OK, we can explore other
possibilities if the issue persists. I doubt it will after this action,
unless, of course, you have some very peculiar configuration I cannot
imagine somewhere. :)
Once I reinstall the above packages, my own program seems to give
1260517800 as output consistently. Mysterious.
The POSIX variant result would be important - it would tell us it's not
Glib related. There would be less stuff to check with just libc/tzdata.
BUT, I made a typo in posix.c, which *could* in effect randomize the
"zone" part of the input iso date. So, first of all - use this new one,
recompile and try again. If it'll work fine, then the issue has been
solved by refreshing those packages. It would mean that some of the
files form your previous tzdata were corrupted.
However, if the issue remains - read on...
I want to see if there's any difference between Linux tzdata and pure
POSIX TZ specification and between our tool and the standard date(1)
command. I need you to run this:
# export TZ=Europe/Prague
# for i in `seq 1 20`; do ./posix; date; done
1260496200
Sun Dec 13 19:04:24 CET 2009
...
# export TZ=CET-1CES,M3.5.0,M10.5.0
# for i in `seq 1 20`; do ./posix; date; done
1260496200
Sun Dec 13 19:04:36 CET 2009
...
# unset TZ
"Europe/Prague" and "CET-1CES,M3.5.0,M10.5.0" is the same description of
my time zone (inc. daylight savings). One points to a tzdata file, the
other has all specs. *in itself*.
I'm dumbfounded. But I'd REALLY like to get to the bottom of this!
Could you please help me explore the other possibilities which could
have lead to this?
Me too, I've never seen this.
From your description the issue seems random. 10 commands executed
almost at the same time return different times. There must be something
screwing your time zone data, resp. data files. That would fit with your
chroot tests - my new test with two different TZ setting methods would
reveal it (one is using tzdata's files, the other does not).
When I look at the results, I'll know where to move next. I'll probably
let you run it again in a single-user mode (e.g. adding kernel param
"init=/bin/sh" via lilo/grub boot menu), to eliminate stuff like ntpd
and other possibly mischievous processes.
Thank you very much for the pointers.
Wait until we'll have fixed it, if ever. :)
--
David Kubicek
#include <stdio.h>
#include <time.h>
void main(void) {
char *iso_date = "2009-12-11T2:50:00";
struct tm tm;
time_t time;
strptime(iso_date, "%FT%T", &tm);
time = mktime(&tm);
printf("%ld\n", time);
}