-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runtime: time.Now clock resolution unexpectedly low on Windows XP. #11313
Comments
As far as I know, the way we extract time, 15.6 milliseconds timer resolution is as good as you're going to get on Windows XP. Let us know if you have a better way to do it.
I don't see where / who sets timer interval to 1ms. Why do you say that? Alex |
I believe it's at https://github.com/golang/go/blob/go1.4.2/src/runtime/os_windows.c#L135 in 1.4.2, and here in latest master commit. To quote you from Sep 9, 2014:
It's also visible by running |
If that's true, that's good enough for me and this issue can stay closed. I've only opened it in case it was an unintended bug. |
Fair enough. I was not sure where 1ms did come. Because no Microsoft documentation mention time. Alex |
I wanted to post a followup update on this issue, for posterity. This issue was originally closed without being resolved, because:
However, it seems it was actually resolved somewhere between Go 1.7 and 1.10. I recently tried the test program (posted in original issue report) on a toy machine with Windows XP (same one used to file the original issue), and here are results I got with Go 1.7 beta 2:
After updating to Go 1.10 (the last version to support Windows XP):
|
What version of Go are you using (go version)?
go version go1.4.2 windows/386
What operating system and processor architecture are you using?
(I don't use this operating system normally, it was done on a one off instance for testing and that's when I made this discovery.)
The Go website lists Windows XP or higher under the system requirements, so as I understand this platform is supported despite being outdated.
What did you do?
What did you expect to see?
A one millisecond clock resolution.
What did you see instead?
A resolution as low as 15.6 milliseconds.
I very unsure if this is a bug or working as expected (I tried asking here). Please close if this is working as expected.
I do suspect it might be a bug, because of the following reason. It is related to findings in #8687.
Specifically, I notice that the Go runtime sets
timeBeginPeriod(1)
at startup, and I can confirm viaClockRes.exe
that it works:(When the Go program isn't running, current timer interval is 15.600 ms.)
Despite the timer interval being set to 1.000 ms when Go programs run, it seems the
time.Now()
clock resolution on Windows XP (but not newer versions of Windows from what I know, I could not verify this) is still as low as 15.6 ms instead of 1.0 ms. Is that an unintended bug, or is it normal expected behavior on this platform?The text was updated successfully, but these errors were encountered: