19 static const char *
const TAG =
"time";
28 struct timeval timev {
29 .tv_sec =
static_cast<time_t
>(epoch), .tv_usec = 0,
31 ESP_LOGVV(TAG,
"Got epoch %" PRIu32, epoch);
32 struct timezone tz = {0, 0};
33 int ret = settimeofday(&timev, &tz);
37 ret = settimeofday(&timev,
nullptr);
44 ESP_LOGW(TAG,
"setimeofday() failed with code %d", ret);
47 auto time = this->
now();
48 ESP_LOGD(TAG,
"Synchronized time: %04d-%02d-%02d %02d:%02d:%02d", time.year, time.month, time.day_of_month, time.hour,
49 time.minute, time.second);
ESPTime now()
Get the time in the currently defined timezone.
CallbackManager< void()> time_sync_callback_
void call_setup() override
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
void synchronize_epoch_(uint32_t epoch)
Report a unix epoch as current time.
void call_setup() override