time
This commit is contained in:
@ -10,7 +10,13 @@ static const char *TAG = "ts";
|
|||||||
static bool synchronized = false;
|
static bool synchronized = false;
|
||||||
|
|
||||||
void timesyncCallback(struct timeval *tv) {
|
void timesyncCallback(struct timeval *tv) {
|
||||||
ESP_LOGI(TAG, "time is synchronized now");
|
struct timespec timestamp;
|
||||||
|
clock_gettime(CLOCK_REALTIME, ×tamp);
|
||||||
|
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;
|
synchronized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user