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:
- 11:96146db429de
- Parent:
- 10:3fcab08717fc
diff -r 3fcab08717fc -r 96146db429de time_helper.cpp
--- a/time_helper.cpp Sun Aug 10 12:34:44 2014 +0000
+++ b/time_helper.cpp Sun Aug 10 15:45:03 2014 +0000
@@ -8,23 +8,11 @@
::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
-)
+void SetTime(const tm & in_sTM)
{
- tm sCurrentTime = { 0 };
- sCurrentTime.tm_year = in_nYear - 1900;
- sCurrentTime.tm_mon = in_nMonth - 1;
- sCurrentTime.tm_mday = in_nDay;
+ tm sTM = { 0 };
+ memcpy(&sTM,&in_sTM,sizeof(sTM));
- sCurrentTime.tm_hour = in_nHour;
- sCurrentTime.tm_min = in_nMin;
-
- time_t nCurrentTime = mktime(&sCurrentTime);
- set_time(nCurrentTime);
+ time_t nTime = mktime(&sTM);
+ set_time(nTime);
}
