winmm: Default to 1ms resolution like we used to.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49564 Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
781d530e9c
commit
e01ef81379
|
@ -74,17 +74,30 @@ static inline void link_timer( WINE_TIMERENTRY *timer )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some observations on the behavior of winmm on Windows.
|
* Some observations on the behavior of winmm on Windows.
|
||||||
* First, the call to timeBeginPeriod(xx) can never be used
|
*
|
||||||
* to raise the timer resolution, only lower it.
|
* First, the call to timeBeginPeriod(xx) can never be used to
|
||||||
|
* lower the timer resolution (i.e. increase the update
|
||||||
|
* interval), only to increase the timer resolution (i.e. lower
|
||||||
|
* the update interval).
|
||||||
*
|
*
|
||||||
* Second, a brief survey of a variety of Win 2k and Win X
|
* Second, a brief survey of a variety of Win 2k and Win X
|
||||||
* machines showed that a 'standard' (aka default) timer
|
* machines showed that a 'standard' (aka default) timer
|
||||||
* resolution was 1 ms (Win9x is documented as being 1). However, one
|
* resolution was 1 ms (Win9x is documented as being 1). However, one
|
||||||
* machine had a standard timer resolution of 10 ms.
|
* machine had a standard timer resolution of 10 ms.
|
||||||
*
|
*
|
||||||
* Further, if we set our default resolution to 1,
|
* Further, timeBeginPeriod(xx) also affects the resolution of
|
||||||
* the implementation of timeGetTime becomes GetTickCount(),
|
* wait calls such as NtDelayExecution() and
|
||||||
* and we can optimize the code to reduce overhead.
|
* NtWaitForMultipleObjects() which by default round up their
|
||||||
|
* timeout to the nearest multiple of 15.625ms across all Windows
|
||||||
|
* versions. In Wine all of those currently work with sub-1ms
|
||||||
|
* accuracy.
|
||||||
|
*
|
||||||
|
* Effective time resolution is a global value that is the max
|
||||||
|
* of the resolutions (i.e. min of update intervals) requested by
|
||||||
|
* all the processes. A lot of programs seem to do
|
||||||
|
* timeBeginPeriod(1) forcing it onto everyone else.
|
||||||
|
*
|
||||||
|
* Defaulting to 1ms accuracy in winmm should be safe.
|
||||||
*
|
*
|
||||||
* Additionally, a survey of Event behaviors shows that
|
* Additionally, a survey of Event behaviors shows that
|
||||||
* if we request a Periodic event every 50 ms, then Windows
|
* if we request a Periodic event every 50 ms, then Windows
|
||||||
|
@ -97,6 +110,7 @@ static inline void link_timer( WINE_TIMERENTRY *timer )
|
||||||
* no delays.
|
* no delays.
|
||||||
*
|
*
|
||||||
* Jeremy White, October 2004
|
* Jeremy White, October 2004
|
||||||
|
* Arkadiusz Hiler, August 2020
|
||||||
*/
|
*/
|
||||||
#define MMSYSTIME_MININTERVAL (1)
|
#define MMSYSTIME_MININTERVAL (1)
|
||||||
#define MMSYSTIME_MAXINTERVAL (65535)
|
#define MMSYSTIME_MAXINTERVAL (65535)
|
||||||
|
@ -255,7 +269,12 @@ MMRESULT WINAPI timeGetSystemTime(LPMMTIME lpTime, UINT wSize)
|
||||||
*/
|
*/
|
||||||
DWORD WINAPI timeGetTime(void)
|
DWORD WINAPI timeGetTime(void)
|
||||||
{
|
{
|
||||||
return GetTickCount();
|
LARGE_INTEGER now, freq;
|
||||||
|
|
||||||
|
QueryPerformanceCounter(&now);
|
||||||
|
QueryPerformanceFrequency(&freq);
|
||||||
|
|
||||||
|
return (now.QuadPart * 1000) / freq.QuadPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue