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
time_helper.cpp
- Committer:
- vtraveller
- Date:
- 2014-08-10
- Revision:
- 10:3fcab08717fc
- Child:
- 11:96146db429de
File content as of revision 10:3fcab08717fc:
#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);
}
