Closed guijan closed 1 year ago
Turns out the other nanosleep()
calls shouldn't even be there (#274), so this PR is ready for review now that it's rebased and tested on OpenBSD.
Now the PR is significantly different, I've done very basic testing on OpenBSD, but it still needs more testing.
Yeah, in an algorithmic sense, both paths are the same: they both make the error relative to the sleep constant. It just annoys me when we don't use the good features of each platform. #ifdef
removed.
This will conflict with #257, has only been minimally tested, and there are other places in the code where it's useful but hasn't been put to use yet, so it remains a draft.
Old
nanosleep()
code (master) on OpenBSD: Newclock_nanosleep()
code (this PR), falling back to a localclock_nanosleep()
implementation on systems lacking this POSIX function like OpenBSD and OS X, running on OpenBSD: The timing error is consistently smaller across several runs. If you subtract the user and system runtime and the 60 second sleep from the real runtime, you get the timing error. It has been reduced by an order of magnitude here.