- Sleep(1) sleeps for exactly 1 second.
- Sleep(1) sleeps for approximately 1 second.
- Sleep(1) sleeps for at least 1 second.
- Sleep(1) sleeps for an unknown, but short amount of time. Certainly not weeks, months or years.
- Sleep(1) sleeps for exactly 1 second.
- Sleep(1) sleeps for approximately 1 second.
- Sleep(1) sleeps for at least 1 second.
- Sleep(1) sleeps for an unknown, but short amount of time. Certainly not weeks, months or years.
This is correct - Sleep(1) does sleep for approximately 1 second; the problem is you're confusing the 95% confidence interval (which might be as narrow as (999ms,1001ms) for some reasonable designs) with the absolute error bounds (which are (0ms,∞ms], and yes, the infinity end is inclusive).
This is surprisingly common when running on certain VM instance types on public cloud! Common enough that I've had to account for it in production code.
Unless you actually expect your environment to spend more than 5% of its time on average getting suspended and resumed. Maybe you work on some tooling that is scheduled to run right around migration time (for servers) or sleep/resume time (for clients).