CaryCoders / Mbed 2 deprecated SX1276_GPS

Dependencies:   SX1276Lib AdaFruit_RGBLCD MCP23017 mbed

Fork of AdaFruit_RGBLCD by Justin Howard

time_helper.cpp

Committer:
vtraveller
Date:
2014-08-10
Revision:
11:96146db429de
Parent:
10:3fcab08717fc

File content as of revision 11:96146db429de:

#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(const tm & in_sTM)
{
    tm sTM = { 0 };
    memcpy(&sTM,&in_sTM,sizeof(sTM));
    
    time_t nTime = mktime(&sTM);
    set_time(nTime);    
}