15 static const char *
const TAG =
"time";
24 struct timeval timev {
25 .tv_sec =
static_cast<time_t
>(epoch), .tv_usec = 0,
27 ESP_LOGVV(TAG,
"Got epoch %" PRIu32, epoch);
29 int ret = settimeofday(&timev, &tz);
33 ret = settimeofday(&timev,
nullptr);
40 ESP_LOGW(TAG,
"setimeofday() failed with code %d", ret);
43 auto time = this->
now();
44 ESP_LOGD(TAG,
"Synchronized time: %04d-%02d-%02d %02d:%02d:%02d", time.year, time.month, time.day_of_month, time.hour,
45 time.minute, time.second);
ESPTime now()
Get the time in the currently defined timezone.
CallbackManager< void()> time_sync_callback_
void call_setup() override
Implementation of SPI Controller mode.
void synchronize_epoch_(uint32_t epoch)
Report a unix epoch as current time.
void call_setup() override