diff --git a/ESP32/FvHNTP/FvHNTP.h b/ESP32/FvHNTP/FvHNTP.h index 64e3210..b7b7f6e 100644 --- a/ESP32/FvHNTP/FvHNTP.h +++ b/ESP32/FvHNTP/FvHNTP.h @@ -17,8 +17,8 @@ private: std::mutex lock; std::string server; std::thread *th { nullptr }; - uint32_t millis_at_ts { 0 }; - uint64_t ntp_at_ts { 0 }; // milliseconds! + uint32_t micros_at_ts { 0 }; + uint64_t ntp_at_ts { 0 }; // us! public: ntp(const std::string & upstream_server); @@ -26,7 +26,7 @@ public: void begin(); - std::optional get_unix_epoch_ms(); + std::optional get_unix_epoch_us(); void operator()(); }; diff --git a/log.cpp b/log.cpp index a6445ac..5059937 100644 --- a/log.cpp +++ b/log.cpp @@ -167,9 +167,9 @@ void dolog(const log_level_t ll, const char *fmt, ...) uint64_t now = 0; if (ntp_clock) { - auto temp = ntp_clock->get_unix_epoch_ms(); + auto temp = ntp_clock->get_unix_epoch_us(); if (temp.has_value()) - now = temp.value() * 1000; + now = temp.value(); } #else uint64_t now = get_us();