This commit is contained in:
2021-03-10 10:15:20 +01:00
parent ec3bea82c3
commit ee0243e134

View File

@ -10,7 +10,13 @@ static const char *TAG = "ts";
static bool synchronized = false;
void timesyncCallback(struct timeval *tv) {
ESP_LOGI(TAG, "time is synchronized now");
struct timespec timestamp;
clock_gettime(CLOCK_REALTIME, &timestamp);
uint32_t current_seconds = timestamp.tv_sec;
uint32_t current_milliseconds = timestamp.tv_nsec / 1e6;
ESP_LOGI(TAG, "time is synchronized now: %u s %u ms", current_secound, current_milliseconds);
synchronized = true;
}