Problem with local date and time

View: New views
1 Messages — Rating Filter:   Alert me  

Problem with local date and time

by Ethernut :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion