Updated Qt driver FCEUD_GetTime and FCEUD_GetTimeFreq functions to allow for a higher timing resolution.

This commit is contained in:
harry 2023-05-21 18:41:24 -04:00
parent 70aa850c15
commit 43cd7ef60a
1 changed files with 25 additions and 2 deletions

View File

@ -62,6 +62,7 @@
#include "common/os_utils.h"
#include "common/configSys.h"
#include "utils/timeStamp.h"
#include "../../oldmovie.h"
#include "../../types.h"
@ -191,7 +192,23 @@ const char *FCEUD_GetCompilerString(void)
uint64
FCEUD_GetTime(void)
{
return SDL_GetTicks();
uint64 t;
if (FCEU::timeStampModuleInitialized())
{
FCEU::timeStampRecord ts;
ts.readNew();
t = ts.toCounts();
}
else
{
t = (double)SDL_GetTicks();
t = t * 1e-3;
}
return t;
}
/**
@ -201,7 +218,13 @@ uint64
FCEUD_GetTimeFreq(void)
{
// SDL_GetTicks() is in milliseconds
return 1000;
uint64 f = 1000;
if (FCEU::timeStampModuleInitialized())
{
f = FCEU::timeStampRecord::countFreq();
}
return f;
}
/**