From 43cd7ef60aead6b9e6b91c8f6c57c43bbd53ea81 Mon Sep 17 00:00:00 2001 From: harry Date: Sun, 21 May 2023 18:41:24 -0400 Subject: [PATCH] Updated Qt driver FCEUD_GetTime and FCEUD_GetTimeFreq functions to allow for a higher timing resolution. --- src/drivers/Qt/fceuWrapper.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/drivers/Qt/fceuWrapper.cpp b/src/drivers/Qt/fceuWrapper.cpp index b906a870..c907b104 100644 --- a/src/drivers/Qt/fceuWrapper.cpp +++ b/src/drivers/Qt/fceuWrapper.cpp @@ -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; } /**