1
6
7
8
9
10
12
13
14
15
16
/* ... */
#include "sdkconfig.h"
#include <stdint.h>
#if CONFIG_IDF_TARGET_LINUX
#include <sys/time.h>
#include <time.h>/* ... */
#else
#include "esp_timer.h"
#endif
uint64_t esp_tls_get_platform_time(void)
{
#if CONFIG_IDF_TARGET_LINUX
struct timeval time = {};
gettimeofday(&time, NULL);
uint64_t curr_time = ((uint64_t)time.tv_sec * 1000000) + (time.tv_usec);
return curr_time;/* ... */
#else
return esp_timer_get_time();/* ... */
#endif
}{ ... }