Skip to content

Conversation

@lemenkov
Copy link
Member

Replace legacy POSIX timing APIs with modern C++11 equivalents.

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 <[email protected]>
Assisted-by: Claude (Anthropic) <https://claude.ai>
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 <[email protected]>
Assisted-by: Claude (Anthropic) <https://claude.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant