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: SX1276Lib AdaFruit_RGBLCD MCP23017 mbed
Fork of AdaFruit_RGBLCD by
Diff: time_helper.cpp
- Revision:
- 10:3fcab08717fc
- Child:
- 11:96146db429de
diff -r 1501fb01ded6 -r 3fcab08717fc time_helper.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/time_helper.cpp Sun Aug 10 12:34:44 2014 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+#include "time_helper.h"
+
+void GetTime(tm & out_sTM)
+{
+ time_t nTime = time(0);
+ tm * pTM = ::localtime(&nTime);
+ ::memcpy(&out_sTM,pTM,sizeof(out_sTM));
+}
+
+void SetTime
+(
+ uint8_t in_nHour,
+ uint8_t in_nMin,
+ uint8_t in_nDay,
+ uint8_t in_nMonth,
+ uint16_t in_nYear
+)
+{
+ tm sCurrentTime = { 0 };
+ sCurrentTime.tm_year = in_nYear - 1900;
+ sCurrentTime.tm_mon = in_nMonth - 1;
+ sCurrentTime.tm_mday = in_nDay;
+
+ sCurrentTime.tm_hour = in_nHour;
+ sCurrentTime.tm_min = in_nMin;
+
+ time_t nCurrentTime = mktime(&sCurrentTime);
+ set_time(nCurrentTime);
+}
