- All Games: Remove use of timerGetHiTicks().

This commit is contained in:
Mitchell Richters 2020-08-26 09:27:09 +10:00
parent b883204f6a
commit aba5c4c134
9 changed files with 9 additions and 14 deletions

View file

@ -783,7 +783,7 @@ static void gameInit()
static void gameTicker()
{
bool gameUpdate = false;
double const gameUpdateStartTime = timerGetHiTicks();
double const gameUpdateStartTime = I_msTimeF();
while (gPredictTail < gNetFifoHead[myconnectindex] && !paused)
{
viewUpdatePrediction(&gFifoInput[gPredictTail & 255][myconnectindex]);
@ -815,7 +815,7 @@ static void gameTicker()
}
if (gameUpdate)
{
g_gameUpdateTime = timerGetHiTicks() - gameUpdateStartTime;
g_gameUpdateTime = I_msTimeF() - gameUpdateStartTime;
if (g_gameUpdateAvgTime < 0.f)
g_gameUpdateAvgTime = g_gameUpdateTime;
g_gameUpdateAvgTime = ((GAMEUPDATEAVGTIMENUMSAMPLES - 1.f) * g_gameUpdateAvgTime + g_gameUpdateTime) / ((float)GAMEUPDATEAVGTIMENUMSAMPLES);
@ -826,7 +826,7 @@ static void gameTicker()
{
netCheckSync();
viewDrawScreen();
g_gameUpdateAndDrawTime = g_beforeSwapTime/* timerGetHiTicks()*/ - gameUpdateStartTime;
g_gameUpdateAndDrawTime = g_beforeSwapTime/* I_msTimeF()*/ - gameUpdateStartTime;
}
}

View file

@ -112,7 +112,7 @@ void ctrlGetInput(void)
ControlInfo info;
static double lastInputTicks;
auto const currentHiTicks = timerGetHiTicks();
auto const currentHiTicks = I_msTimeF();
double const elapsedInputTicks = currentHiTicks - lastInputTicks;
lastInputTicks = currentHiTicks;

View file

@ -1105,7 +1105,7 @@ FString GameInterface::statFPS(void)
static float lastFPS, minFPS = FLT_MAX, maxFPS;
static double minGameUpdate = DBL_MAX, maxGameUpdate;
double frameTime = timerGetHiTicks();
double frameTime = I_msTimeF();
double frameDelay = frameTime - lastFrameTime;
cumulativeFrameDelay += frameDelay;

View file

@ -8,7 +8,6 @@
// for compatibility
#define timerUninit()
double timerGetHiTicks(void);
uint32_t timerGetTicks(void);
#endif // timer_h__

View file

@ -2722,7 +2722,7 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups
//
void videoNextPage(void)
{
g_beforeSwapTime = timerGetHiTicks();
g_beforeSwapTime = I_msTimeF();
videoShowFrame(0);
omdtims = mdtims;

View file

@ -16,7 +16,3 @@ static time_point<steady_clock> timerlastsample;
static int timerticspersec;
uint32_t timerGetTicks(void) { return duration_cast<milliseconds>(steady_clock::now().time_since_epoch()).count(); }
// Returns the time since an unspecified starting time in milliseconds.
// (May be not monotonic for certain configurations.)
double timerGetHiTicks(void) { return duration<double, nano>(steady_clock::now().time_since_epoch()).count() / 1000000.0; }

View file

@ -401,7 +401,7 @@ FString GameInterface::statFPS()
static float lastFPS; // , minFPS = std::numeric_limits<float>::max(), maxFPS;
//static double minGameUpdate = std::numeric_limits<double>::max(), maxGameUpdate;
double frameTime = timerGetHiTicks();
double frameTime = I_msTimeF();
double frameDelay = frameTime - lastFrameTime;
cumulativeFrameDelay += frameDelay;

View file

@ -149,7 +149,7 @@ void PlayerInterruptKeys()
CONTROL_GetInput(&info);
static double lastInputTicks;
auto const currentHiTicks = timerGetHiTicks();
auto const currentHiTicks = I_msTimeF();
double const elapsedInputTicks = currentHiTicks - lastInputTicks;
lastInputTicks = currentHiTicks;

View file

@ -115,7 +115,7 @@ getinput(SW_PACKET *loc, SWBOOL tied)
static double lastInputTicks;
auto const currentHiTicks = timerGetHiTicks();
auto const currentHiTicks = I_msTimeF();
elapsedInputTicks = currentHiTicks - lastInputTicks;
lastInputTicks = currentHiTicks;