winmm: Add timeGetTime() implementation.

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:
Arkadiusz Hiler 2020-08-25 10:54:00 +03:00 committed by Alexandre Julliard
parent 6135048695
commit 781d530e9c
5 changed files with 22 additions and 16 deletions

View File

@ -202,12 +202,12 @@ static void test_api(void)
if (winetest_interactive)
{
#define MAX_TIME 15000
DWORD tick = GetTickCount(), spent;
DWORD tick = timeGetTime(), spent;
infoex.ex.dwSize = sizeof(infoex.ex);
infoex.ex.dwFlags = JOY_RETURNALL;
do
{
spent = GetTickCount() - tick;
spent = timeGetTime() - tick;
ret = joyGetPosEx(joyid, &infoex.ex);
if (ret == JOYERR_NOERROR)
{

View File

@ -555,7 +555,7 @@ static void CALLBACK time_stamp_callback(HMIDIOUT hmo, UINT msg, DWORD_PTR insta
switch (msg) {
case MM_MOM_POSITIONCB:
if (records->count < ARRAY_SIZE(records->time_stamp))
records->time_stamp[records->count] = GetTickCount();
records->time_stamp[records->count] = timeGetTime();
records->count++;
break;
case MM_MOM_DONE:

View File

@ -131,7 +131,7 @@ static int TIME_MMSysTimeCallback(void)
}
timer = LIST_ENTRY( ptr, WINE_TIMERENTRY, entry );
delta_time = timer->dwTriggerTime - GetTickCount();
delta_time = timer->dwTriggerTime - timeGetTime();
if (delta_time > 0) break;
list_remove( &timer->entry );
@ -242,16 +242,22 @@ void TIME_MMTimeStop(void)
*/
MMRESULT WINAPI timeGetSystemTime(LPMMTIME lpTime, UINT wSize)
{
if (wSize >= sizeof(*lpTime)) {
lpTime->wType = TIME_MS;
lpTime->u.ms = GetTickCount();
lpTime->u.ms = timeGetTime();
}
return 0;
}
/**************************************************************************
* timeGetTime [WINMM.@]
*/
DWORD WINAPI timeGetTime(void)
{
return GetTickCount();
}
/**************************************************************************
* timeSetEvent [WINMM.@]
*/
@ -272,7 +278,7 @@ MMRESULT WINAPI timeSetEvent(UINT wDelay, UINT wResol, LPTIMECALLBACK lpFunc,
return 0;
lpNewTimer->wDelay = wDelay;
lpNewTimer->dwTriggerTime = GetTickCount() + wDelay;
lpNewTimer->dwTriggerTime = timeGetTime() + wDelay;
/* FIXME - wResol is not respected, although it is not clear
that we could change our precision meaningfully */

View File

@ -1030,7 +1030,7 @@ static DWORD midistream_get_playing_position(WINE_MIDIStream* lpMidiStrm)
case MSM_STATUS_PAUSED:
return lpMidiStrm->dwElapsedMS;
case MSM_STATUS_PLAYING:
return GetTickCount() - lpMidiStrm->dwStartTicks;
return timeGetTime() - lpMidiStrm->dwStartTicks;
default:
FIXME("Unknown playing status %hu\n", lpMidiStrm->status);
return 0;
@ -1080,7 +1080,7 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI
/* FIXME: send out cc64 0 (turn off sustain pedal) on every channel */
if (lpMidiStrm->status != MSM_STATUS_PLAYING) {
EnterCriticalSection(&lpMidiStrm->lock);
lpMidiStrm->dwStartTicks = GetTickCount() - lpMidiStrm->dwElapsedMS;
lpMidiStrm->dwStartTicks = timeGetTime() - lpMidiStrm->dwElapsedMS;
lpMidiStrm->status = MSM_STATUS_PLAYING;
LeaveCriticalSection(&lpMidiStrm->lock);
}
@ -1090,7 +1090,7 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI
/* FIXME: send out cc64 0 (turn off sustain pedal) on every channel */
if (lpMidiStrm->status != MSM_STATUS_PAUSED) {
EnterCriticalSection(&lpMidiStrm->lock);
lpMidiStrm->dwElapsedMS = GetTickCount() - lpMidiStrm->dwStartTicks;
lpMidiStrm->dwElapsedMS = timeGetTime() - lpMidiStrm->dwStartTicks;
lpMidiStrm->status = MSM_STATUS_PAUSED;
LeaveCriticalSection(&lpMidiStrm->lock);
}
@ -1126,7 +1126,7 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI
case WINE_MSM_HEADER:
/* sets initial tick count for first MIDIHDR */
if (!lpMidiStrm->dwStartTicks)
lpMidiStrm->dwStartTicks = GetTickCount();
lpMidiStrm->dwStartTicks = timeGetTime();
lpMidiHdr = (LPMIDIHDR)msg->lParam;
lpData = (LPBYTE)lpMidiHdr->lpData;
TRACE("Adding %s lpMidiHdr=%p [lpData=0x%p dwBytesRecorded=%u/%u dwFlags=0x%08x size=%lu]\n",
@ -1235,8 +1235,8 @@ start_header:
dwToGo = lpMidiStrm->dwStartTicks + lpMidiStrm->position_usec / 1000;
TRACE("%u/%u/%u\n", dwToGo, GetTickCount(), me->dwDeltaTime);
while (dwToGo - (dwCurrTC = GetTickCount()) <= MAXLONG) {
TRACE("%u/%u/%u\n", dwToGo, timeGetTime(), me->dwDeltaTime);
while (dwToGo - (dwCurrTC = timeGetTime()) <= MAXLONG) {
if (MsgWaitForMultipleObjects(0, NULL, FALSE, dwToGo - dwCurrTC, QS_ALLINPUT) == WAIT_OBJECT_0) {
/* got a message, handle it */
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) {

View File

@ -147,7 +147,7 @@
@ stdcall timeEndPeriod(long)
@ stdcall timeGetDevCaps(ptr long)
@ stdcall timeGetSystemTime(ptr long)
@ stdcall timeGetTime() kernel32.GetTickCount
@ stdcall timeGetTime()
@ stdcall timeKillEvent(long)
@ stdcall timeSetEvent(long long ptr long long)
@ stdcall waveInAddBuffer(long ptr long)