Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbos Watchdog TextLCD mbed ConfigFile
Diff: Task5SetTime.cpp
- Revision:
- 2:8917036cbf69
--- /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
+ }
+ }
+}