mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Let's try an experiment: move the epoch forward as I_GetTime is called
This will make it even longer until time wraps around. Have you ever run a srb2 server for 4 years straight?
This commit is contained in:
parent
b72789b0c9
commit
515d7eeb9e
1 changed files with 11 additions and 1 deletions
|
@ -2044,12 +2044,20 @@ ticcmd_t *I_BaseTiccmd2(void)
|
|||
//
|
||||
|
||||
static Uint64 timer_frequency;
|
||||
|
||||
static double tic_frequency;
|
||||
static Uint64 tic_epoch;
|
||||
|
||||
tic_t I_GetTime(void)
|
||||
{
|
||||
static double elapsed;
|
||||
|
||||
const Uint64 now = SDL_GetPerformanceCounter();
|
||||
return (now - tic_epoch) * NEWTICRATE / timer_frequency;
|
||||
|
||||
elapsed += (now - tic_epoch) / tic_frequency;
|
||||
tic_epoch = now; // moving epoch
|
||||
|
||||
return (tic_t)elapsed;
|
||||
}
|
||||
|
||||
precise_t I_GetPreciseTime(void)
|
||||
|
@ -2069,6 +2077,8 @@ void I_StartupTimer(void)
|
|||
{
|
||||
timer_frequency = SDL_GetPerformanceFrequency();
|
||||
tic_epoch = SDL_GetPerformanceCounter();
|
||||
|
||||
tic_frequency = timer_frequency / NEWTICRATE;
|
||||
}
|
||||
|
||||
void I_Sleep(void)
|
||||
|
|
Loading…
Reference in a new issue