mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-15 20:20:54 +00:00
- directly cast steady_clock::now()
to nanoseconds instead of microseconds then multiplying by 1000.
This commit is contained in:
parent
5000fde281
commit
f8952d5cae
2 changed files with 1 additions and 4 deletions
|
@ -48,12 +48,10 @@ static uint64_t CurrentFrameStartTime;
|
||||||
static uint64_t FreezeTime;
|
static uint64_t FreezeTime;
|
||||||
int GameTicRate = 35; // make sure it is not 0, even if the client doesn't set it.
|
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()
|
static uint64_t GetClockTimeNS()
|
||||||
{
|
{
|
||||||
using namespace std::chrono;
|
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)
|
static uint64_t MSToNS(unsigned int ms)
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
extern int GameTicRate;
|
extern int GameTicRate;
|
||||||
extern double TimeScale;
|
|
||||||
|
|
||||||
// Called by D_DoomLoop, sets the time for the current frame
|
// Called by D_DoomLoop, sets the time for the current frame
|
||||||
void I_SetFrameTime();
|
void I_SetFrameTime();
|
||||||
|
|
Loading…
Reference in a new issue