- directly cast steady_clock::now() to nanoseconds instead of microseconds then multiplying by 1000.

This commit is contained in:
Mitchell Richters 2020-07-31 13:06:52 +10:00 committed by Christoph Oelckers
parent 5000fde281
commit f8952d5cae
2 changed files with 1 additions and 4 deletions

View file

@ -48,12 +48,10 @@ static uint64_t CurrentFrameStartTime;
static uint64_t FreezeTime;
int GameTicRate = 35; // make sure it is not 0, even if the client doesn't set it.
double TimeScale = 1.0;
static uint64_t GetClockTimeNS()
{
using namespace std::chrono;
return (uint64_t)((duration_cast<microseconds>(steady_clock::now().time_since_epoch()).count()) * (uint64_t)(TimeScale * 1000));
return (uint64_t)(duration_cast<nanoseconds>(steady_clock::now().time_since_epoch()).count());
}
static uint64_t MSToNS(unsigned int ms)

View file

@ -3,7 +3,6 @@
#include <stdint.h>
extern int GameTicRate;
extern double TimeScale;
// Called by D_DoomLoop, sets the time for the current frame
void I_SetFrameTime();