Delving into the Usefulness of std::chrono::high_resolution_clock
Although initially considered suitable for performance measurements, the use of std::chrono::high_resolution_clock raises concerns due to potential clock adjustments and an inability to convert to calendar time. This leaves the question of its practical applications.
Scrutinizing Possible Uses
Conclusion: An Elusive Purpose
After examining the limitations of high_resolution_clock, it becomes evident that it lacks substantial utility. Its use should be avoided in favor of the more reliable steady_clock.
Exceptions to Avoidance
While generally discouraged, there are specific situations where high_resolution_clock may be appropriate:
However, these exceptions should be considered with caution and alternative approaches explored whenever possible.
The above is the detailed content of When Should You (and Shouldn't You) Use `std::chrono::high_resolution_clock`?. For more information, please follow other related articles on the PHP Chinese website!