19 #include <uuid/common.h>
22 #if defined(ARDUINO_ARCH_ESP32)
23 # include <esp_timer.h>
24 #elif UUID_COMMON_THREAD_SAFE
31 #if defined(ARDUINO_ARCH_ESP32)
32 return esp_timer_get_time() / 1000ULL;
34 # if UUID_COMMON_THREAD_SAFE
35 static std::mutex mutex;
37 static uint32_t high_millis = 0;
38 static uint32_t low_millis = 0;
40 uint32_t now_millis = ::millis();
41 # if UUID_COMMON_THREAD_SAFE
42 std::lock_guard<std::mutex> lock{mutex};
45 if (now_millis < low_millis) {
49 low_millis = now_millis;
51 return ((uint64_t)high_millis << 32) | low_millis;