mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 23:08:31 +00:00
Improve time/sleep accuracy on Windows
It's now almost as good as Linux thanks to a Windows 8+ API.
This commit is contained in:
parent
72ac5f18d9
commit
8caf1b48a9
9 changed files with 76 additions and 31 deletions
|
@ -40,7 +40,11 @@ static dontinline int __clk_tck_init(void) {
|
|||
size_t len;
|
||||
struct clockinfo_netbsd clock;
|
||||
if (IsWindows()) {
|
||||
x = 1000;
|
||||
// MSVC defines CLK_TCK as 1000 but 1ms is obviously not the
|
||||
// scheduling quantum Windows actually uses. If we define it
|
||||
// as 30 rather than 1000, then clock_nanosleep is much more
|
||||
// accurately able to predict the duration of its busy waits
|
||||
x = 30;
|
||||
} else if (IsXnu() || IsOpenbsd()) {
|
||||
x = 100;
|
||||
} else if (IsFreebsd()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue