Guido Ottaviani / Mbed 2 deprecated LeonardoMbos

Dependencies:   mbos Watchdog TextLCD mbed ConfigFile

Revision:
2:8917036cbf69
diff -r 360c4a23cb1d -r 8917036cbf69 Task5SetTime.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Task5SetTime.cpp	Tue Jan 31 00:22:58 2012 +0000
@@ -0,0 +1,29 @@
+#include "Task5SetTime.h"
+
+void SetTimeTask(void)
+{/**
+ *\brief TASK 5, Set RTC system time if the GPS time is valid
+ */
+ struct tm t;
+ 
+ os.SetTimer(SET_TIME_TMR, 60000, 60000);
+ while(1)
+ {  
+ os.WaitEvent(SET_TIME_EVT);
+
+    if(info.sig != 0)    
+    {
+       t.tm_mday=info.utc.day;
+       t.tm_mon=info.utc.mon;
+       t.tm_year=info.utc.year; 
+       t.tm_hour=info.utc.hour;
+       t.tm_min=info.utc.min;
+       t.tm_sec=info.utc.sec;        
+          
+        time_t seconds = mktime(&t);       
+        set_time(seconds);
+        
+        SetTimeOk = 1; // RTC was set 
+    }
+ }    
+}