endail/hx711

std::chrono::high_resolution_clock use is ambiguous

endail opened this issue · 0 comments

https://en.cppreference.com/w/cpp/chrono/high_resolution_clock

The high_resolution_clock is not implemented consistently across different standard library implementations, and its use should be avoided. It is often just an alias for std::chrono::steady_clock or std::chrono::system_clock, but which one it is depends on the library or configuration. When it is a system_clock, it is not monotonic (e.g., the time can go backwards). For example, for gcc's libstdc++ it is system_clock, for MSVC it is steady_clock, and for clang's libc++ it depends on configuration.

Generally one should just use std::chrono::steady_clock or std::chrono::system_clock directly instead of std::chrono::high_resolution_clock: use steady_clock for duration measurements, and system_clock for wall-clock time.

https://github.com/endail/hx711/search?q=high_resolution_clock shows it being used in contexts where a steady clock (ie. std::chrono::steady_clock) should explicitly be used.