Ok, this is odd.

I was just testing my Timer class and for some reason both win32 Sleep and C++ std::this_thread::sleep_for are unable to sleep for less than around 15ms.

Even just a bare for loop doing Sleep(1) 100 times results in a delay or around 1.5s.

I even made a new project with just this (the pic) and it took 15s to run.

Has win 10 changed sleep precision?

I'll reboot and see what happens.

@kojack you can check your clock resolution 🤔 https://learn.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timegetdevcaps

There's some ways to ask the clock to tick faster, maybe your default was set pretty high ?

timeGetDevCaps function (timeapi.h) - Win32 apps

The timeGetDevCaps function queries the timer device to determine its resolution.

@kojack https://learn.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod?source=recommendations
Apparently win10 did change the way they handle clock res at a process level, so maybe your system default is just 15ms or something
timeBeginPeriod function (timeapi.h) - Win32 apps

The timeBeginPeriod function requests a minimum resolution for periodic timers.

@Sharundaar I just found an article by Bruce Dawson mentioning the same thing: https://randomascii.wordpress.com/2020/10/04/windows-timer-resolution-the-great-rule-change/

I haven't used low sleeps for a while, I used to do Sleep(1) to slow down Ogre3D to 1000fps so my gfx card didn't overheat. :)

Windows Timer Resolution: The Great Rule Change

The behavior of the Windows scheduler changed significantly in Windows 10 2004 (aka, the April 2020 version of Windows), in a way that will break a few applications, and there appears to have been …

Random ASCII - tech blog of Bruce Dawson
@kojack noice, that's cool. I remember doing the same for some OpenGL application but ended up just relying on VSync x)

@Sharundaar Luckily the sleep is just part of a unit test, I don't actually need it. Just a bit surprising.

Vsync worked too, but Ogre had a dialog where it could be turned off, so for safety I just did the sleep. Commercial games did it to me too, Red Faction Guerilla ran its menu at unlimited speed, made me reboot.