fixes for uS resolution ntp
This commit is contained in:
parent
8c8084ec5b
commit
e41e37105a
2 changed files with 5 additions and 5 deletions
|
@ -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<uint64_t> get_unix_epoch_ms();
|
||||
std::optional<uint64_t> get_unix_epoch_us();
|
||||
|
||||
void operator()();
|
||||
};
|
||||
|
|
4
log.cpp
4
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();
|
||||
|
|
Loading…
Add table
Reference in a new issue