A time interface class. This class replicates the normal time functions, but goes a couple of steps further. mbed library 82 and prior has a defective gmtime function. Also, this class enables access to setting the time, and adjusting the accuracy of the RTC.

Dependencies:   CalendarPage

Dependents:   CI-data-logger-server WattEye X10Svr SSDP_Server

Files at this revision

API Documentation at this revision

Comitter:
WiredHome
Date:
Sat Jun 28 19:49:26 2014 +0000
Parent:
2:65e0a25c7551
Child:
4:9cae2da8215e
Commit message:
Efforts focused on getting dst interface working.

Changed in this revision

TimeInterface.cpp Show annotated file Show diff for this revision Revisions of this file
TimeInterface.h Show annotated file Show diff for this revision Revisions of this file
--- a/TimeInterface.cpp	Sun Jun 22 21:00:01 2014 +0000
+++ b/TimeInterface.cpp	Sat Jun 28 19:49:26 2014 +0000
@@ -3,7 +3,7 @@
 
 #include "rtc_api.h"
 
-#define DEBUG "Time"
+//#define DEBUG "Time"
 #include <cstdio>
 #if (defined(DEBUG) && !defined(TARGET_LPC11U24))
 #define DBG(x, ...)  std::printf("[DBG %s %3d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__);
@@ -57,6 +57,16 @@
     return res;
 }
 
+void set_dst(bool dst)
+{
+    (void)dst;
+}
+
+bool get_dst(void)
+{
+    return false;   
+}
+
 clock_t TimeInterface::clock(void)
 {
     return std::clock();
--- a/TimeInterface.h	Sun Jun 22 21:00:01 2014 +0000
+++ b/TimeInterface.h	Sat Jun 28 19:49:26 2014 +0000
@@ -209,6 +209,23 @@
     ///
     int16_t get_tzo_min(void);
     
+    /// Set the clock for local time to report whether the current
+    /// mode is standard or daylight savings time.
+    ///
+    /// return values for localtime will then be adjusted not only
+    /// for the time zone offset, but for dst.
+    ///
+    /// @param[in] dst is a boolean that should be set when dst is
+    ///         the active mode.
+    ///
+    void set_dst(bool dst);
+    
+    /// Get the current clock mode for daylight savings time.
+    ///
+    /// @returns true if clock is in dst mode.
+    ///
+    bool get_dst(void);
+    
     /// Get the time value when the clock was last set. This is most
     /// often used in calibration of the clock.
     ///