btgps/src/calendar.c

28 lines
429 B
C
Raw Normal View History

2024-07-20 23:32:01 +00:00
#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;
}