Modernize timing functions with C++11 std::chrono#854
Modernize timing functions with C++11 std::chrono#854lemenkov wants to merge 3 commits intoSIPp:masterfrom
Conversation
|
What's the point of removing |
I believe the original commit (1f5c3ba) made sense at the time - separating the side effect of updating That said, this is a minor style preference - I am not going to insist on it and happy to revert that particulat part of this PR. |
|
Comments are wrong now: and [edit] p.s. I prefer |
I'm on it. |
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
The sipp_usleep() function was a workaround for POSIX usleep() having undefined behavior for values >= 1,000,000 microseconds. However: - usleep() was deprecated in POSIX.1-2001 and removed in POSIX.1-2008 - C++11 std::this_thread::sleep_for() handles arbitrary durations correctly - The function was only used in 3 places, none requiring microsecond precision Replace with direct std::this_thread::sleep_for() calls using appropriate std::chrono duration types. Signed-off-by: Peter Lemenkov <lemenkov@gmail.com> Assisted-by: Claude (Anthropic) <https://claude.ai>
18be409 to
2f9387b
Compare
They were wrong even before. I updated these comments in a separate commit before others. |
Use std::chrono::steady_clock instead of clock_gettime() with platform-specific workarounds. This removes: - Obsolete macOS Mach clock workaround (clock_gettime available since 10.12) - CLOCK_MONOTONIC_COARSE optimization (negligible performance impact) - Legacy includes: time.h, sys/time.h, unistd.h, mach/clock.h, mach/mach.h Signed-off-by: Peter Lemenkov <lemenkov@gmail.com> Assisted-by: Claude (Anthropic) <https://claude.ai>
2f9387b to
6219f7e
Compare
Replace legacy POSIX timing APIs with modern C++11 equivalents.