28 lines
429 B
C
28 lines
429 B
C
#include "calendar.h"
|
|
|
|
#include <zephyr/logging/log.h>
|
|
LOG_MODULE_REGISTER(calendar);
|
|
|
|
//uint32_t timeoffset = 0xff000078;
|
|
uint32_t timeoffset = 0x00000000;
|
|
|
|
void setTs(uint32_t ts)
|
|
{
|
|
LOG_INF("setTs: %d", ts);
|
|
timeoffset = ts-(k_uptime_get()/1000);
|
|
}
|
|
|
|
|
|
uint32_t getTs()
|
|
{
|
|
uint32_t ts = (k_uptime_get()/1000) + timeoffset;
|
|
// LOG_INF("getTs: %d", ts);
|
|
return ts;
|
|
}
|
|
|
|
bool TsOK()
|
|
{
|
|
return timeoffset != 0;
|
|
}
|
|
|