[En-Nut-Discussion] Problem with local date and time
Harald Kipp
harald.kipp at egnite.de
Tue Jul 7 17:24:02 CEST 2009
Interesting problem:
When starting with a virgin RTC (_timezone=-1), we have
06.02.2106, 07:28:15 UTC+01:00
When using stime() to set the system time to 17:10:00 and date of today,
localtime returns 1 hour offset:
07.07.2009, 18:10:00 DST UTC+02:00
Using the same routine again to set the same time again gives
07.07.2009, 17:10:00 DST UTC+02:00
It looks to me that the problem is with daylight savings time. Setting
the time obviously depends on the time, when stime() is called.
Can anyone confirm this?
We use
struct _tm ltm;
/* Filling ltm from user input */
time_t now = mktime(<m);
stime(&now);
to set the time and
time_t tt = time(NULL);
struct _tm *stm = localtime(&tt);
to get the local time for display.
Harald
More information about the En-Nut-Discussion
mailing list