Skip to content

Use CLOCK_MONOTONIC if available#342

Merged
DeusData merged 1 commit into
DeusData:mainfrom
cmeerw:fix-clock-monotonic
May 30, 2026
Merged

Use CLOCK_MONOTONIC if available#342
DeusData merged 1 commit into
DeusData:mainfrom
cmeerw:fix-clock-monotonic

Conversation

@cmeerw
Copy link
Copy Markdown
Contributor

@cmeerw cmeerw commented May 12, 2026

Only fall back to hardcoded values if CLOCK_MONOTONIC is not defined

@cmeerw
Copy link
Copy Markdown
Contributor Author

cmeerw commented May 12, 2026

Should have mentioned, this fixes NetBSD (and likely other BSD) build, as NetBSD has #define CLOCK_VIRTUAL 1 and #define CLOCK_MONOTONIC 3

@DeusData
Copy link
Copy Markdown
Owner

Thank you, @cmeerw! 🙏 Nice improvement — preferring the real CLOCK_MONOTONIC constant when the platform defines it, instead of the hardcoded 6/1 fallback, is both more correct on non-Linux/macOS platforms and clears a magic-number lint warning. Behavior is identical on the platforms we already handle (macOS CLOCK_MONOTONIC==6, Linux==1). Verified locally: build clean, all 3,617 tests pass. Merging via squash — authorship preserved. Thanks!

@DeusData DeusData merged commit 2e110fc into DeusData:main May 30, 2026
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.

2 participants