This library takes the current time (which must be set to UTC, e.g. via an NTP call), and applies a timezone definition (loaded at startup) to calculate the local time. This includes the handling of daylight saving. See http://mbed.org/users/hlipka/notebook/time-zone-handling/ for more information (esp. how to get a time zone definition file).

Dependents:   CubiScan 000-FIN_youcef 005_ESSAI_youcef

Revision:
3:2ad51ec5ef6e
Parent:
0:ab93db24fcc8
Child:
4:c84afcfbac84
--- a/Time.cpp	Wed Dec 22 23:20:43 2010 +0000
+++ b/Time.cpp	Tue Jan 04 23:19:50 2011 +0000
@@ -93,7 +93,7 @@
                     );
         if (13!=r)
             continue;
-        if (fyear<currentYear || tyear>currentYear+5)
+        if (tyear<currentYear || fyear>currentYear+4)
             continue;
         
         TimeStamp *from=new TimeStamp(fyear, fmon, fday, fhour, fmin, fsec);
@@ -115,13 +115,14 @@
     time_t rawtime;
     time ( &rawtime );
     TimeStamp *ts=new TimeStamp(rawtime);
-
+    
     for (list<TimeZoneEntry*>::iterator it = _timeZoneEntries->begin(); it != _timeZoneEntries->end(); it++) {
         TimeZoneEntry* tze=*it;
         if (tze->_from->isBefore(ts) && tze->_to->isAfter(ts))
         {
             rawtime+=tze->_offset;
             ts->updateTime(rawtime);
+            break;
         }
     }