NSPR uses only one function in winmm.dll: timeGetTime(). If we can replace timeGetTime() by an equivalent function, we will be able to remove the dependency on winmm.dll. A good candidate is GetTickCount(). It is documented (http://msdn.microsoft.com/library/psdk/sysmgmt/time_8wz8.htm) that a multimedia timer (timeGetTime()) or a high-resolution timer (QueryPerformanceCounter()) has a higher resolution than GetTickCount(). Because we always try QueryPerformanceCounter() first, if all the hardware that we need to support has a high-resolution performance counter, we should never need to call GetTickCount(). Then, the lower resolution of GetTickCount() will have negligible effect.
Created attachment 10201 [details] [diff] [review] Proposed patch. Replace timeGetTime() with GetTickCount().
I did a test on our Win95 OSR2 and Win98 SE systems, both with Pentium CPUs, and found that QueryPerformanceFrequency() and QueryPerformanceCounter() are supported. So the high-resolution performance counter should be supported on practically all the Windows systems that are in use today. I checked in the patch (id=10201) on the main trunk. /cvsroot/mozilla/nsprpub/pr/src/Makefile, revision 3.34 /cvsroot/mozilla/nsprpub/pr/src/Makefile.in, revision 1.13 /cvsroot/mozilla/nsprpub/pr/src/md/windows/ntinrval.c, revision 3.8 Note that Mozilla is pulling the NSPRPUB_CLIENT_BRANCH of NSPR so it is not picking up this change right now.
Status: ASSIGNED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → FIXED
I checked in the fix on both NSPRPUB_CLIENT_BRANCH and NSPRPUB_RELEASE_4_0_BRANCH. See bug #52725. Set Target Milestone to 4.0.2.
Target Milestone: 4.1 → 4.0.2
You need to log in before you can comment on or make changes to this bug.