Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

windows: use multimedia timer instead of GetTickCount #929

Closed
piscisaureus opened this Issue Sep 13, 2013 · 8 comments

Comments

Projects
None yet
5 participants
Member

piscisaureus commented Sep 13, 2013

Instead of using GetTickCount(), use a multimedia timer (timeGetTime()).

timeGetTime has millisecond resolution is is still reasonably fast.

I means we could get rid of that silly timer forward-fudging after calling GetQueuedCompletionStatus.

The downside is that libuv and libuv users now have to link with the winmm library.

For node it doesn't matter because v8 requires winmm anyway - for the same reason: it uses timeGetTime to implement the Date object.

Contributor

bnoordhuis commented Sep 13, 2013

Can't you load winmm dynamically?

Member

piscisaureus commented Sep 13, 2013

@bnoordhuis Yes, but what would be the advantage of that?

Contributor

bnoordhuis commented Sep 13, 2013

That libuv users don't have to link to winmm? It's basically the same thing we do now for ApplicationServices / CoreServices / CoreFoundation on OS X.

And why not use QueryPerformanceCounter and QueryPerformanceFrequency instead? timeGetTime function can still have a precision of 5 milliseconds or more. Would it be difficult to change DWORD to LARGE_INTEGER to store ticks? Timers would be more precise and it would last a bit longer than 49.71 days until overflow.

Member

piscisaureus commented Sep 20, 2013

@donatasm A long time ago libuv did that, but it had detrimental effects on performance.

I think it's better use NtGetSystemTime. It is more actuate than GetTickCount. (In fact GetTickCount is based on result of NtGetSystemTime)
Regards.

Contributor

saghul commented Sep 5, 2014

Closing as it's beaing dealt with in #1165.

Member

piscisaureus commented Oct 15, 2014

Actually closing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment