timer.cpp: avoid using floating point arithmetic in timerUpdate()

git-svn-id: https://svn.eduke32.com/eduke32@8011 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
pogokeen 2019-08-15 04:38:12 +00:00 committed by Christoph Oelckers
parent 20f5972b9b
commit 0855428a0c

View file

@ -38,7 +38,7 @@ ATTRIBUTE((flatten)) void timerUpdate(void)
{
auto time = steady_clock::now();
auto elapsedTime = time - timerlastsample;
int n = elapsedTime.count() * ((double)timerticspersec / timerGetFreqU64()) * steady_clock::period::num;
int n = elapsedTime.count() * (uint64_t) timerticspersec / timerGetFreqU64() * steady_clock::period::num;
if (n <= 0) return;