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

Weird time-zone oscillation



Dear Debian user,

I have a weird time-zone related issue on my machine. I observed that
the "alarm-clock" package was always ignoring my requests for an alarm
within an hour from now, and all other alarms used to go off with an
hour to spare. So, I did some investigation, and found that it always
converted fixed times to the incorrect time, while the current time is
more clear.

To make it more clear, I wrote the following program:

/*  gcc `pkg-config --cflags --libs glib-2.0` test.c -Wall */
#include <glib.h>
#include <stdio.h>

int
main(void) {
  GTimeVal alarm_time, current_time;
  char *iso_date = "2009-12-11T2:50:00";
  g_time_val_from_iso8601(iso_date, &alarm_time);
  printf("%ld\n", alarm_time.tv_sec);
  g_get_current_time(&current_time);
  return 0;
}

Now, please observe the following outputs:

[kumar@bluemoon ~] for i in `seq 1 10`;do TZ=America/Chicago ./a.out;done
1260517800
1260521400
1260517800
1260517800
1260517800
1260521400
1260517800
1260521400
1260521400
1260521400

[kumar@bluemoon ~] for i in `seq 1 10`;do TZ=Europe/Zurich ./a.out;done
1260492600
1260496200
1260496200
1260496200
1260496200
1260496200
1260492600
1260496200
1260492600
1260496200

Please note that the two different times are separated by an
hour. This led me to suspect daylight savings. Sure enough, with
Asia/Calcutta and Etc/UTC, I got constant values.

I am sure my computer's timekeeping is OK. I could not reproduce this
in any other Debian machines I have access to. In addition, on a Lenny
chroot in the SAME machine, I could not reproduce it (everything was
in order). Could someone suggest as to why this is happening?

I use sid, and the glib version is 2.22.3-1.

Thanks!

Kumar
-- 
The most effective has probably been Linux/8086 - that was a joke
that got out of hand.  So far out of hand in fact its almost approaching
usability because other folks thought it worth doing - Alistair Riddoch
especially.
		-- Alan Cox

Attachment: signature.asc
Description: Digital signature


Reply to: