mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-26 05:41:52 +00:00
win: Make sure sys_clockprecision gets applied at startup, which should help improve emulated system timer precision.
This commit is contained in:
parent
aa43bc40f7
commit
3357338ab7
1 changed files with 17 additions and 15 deletions
|
@ -1756,6 +1756,21 @@ void VARGS Sys_Printf (char *fmt, ...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned int sys_interrupt_freq;
|
||||||
|
static void Sys_ClockPrecision_Changed(cvar_t *var, char *oldval)
|
||||||
|
{
|
||||||
|
if (sys_interrupt_freq)
|
||||||
|
timeEndPeriod(sys_interrupt_freq);
|
||||||
|
sys_interrupt_freq = 0;
|
||||||
|
|
||||||
|
if (var && var->ival > 0)
|
||||||
|
{
|
||||||
|
sys_interrupt_freq = var->ival;
|
||||||
|
if (TIMERR_NOERROR != timeBeginPeriod(sys_interrupt_freq) && oldval)
|
||||||
|
Con_Printf(CON_ERROR"%s: timeBeginPeriod(%u) failed.\n", var->name, sys_interrupt_freq);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static quint64_t timer_qpc_frequency;
|
static quint64_t timer_qpc_frequency;
|
||||||
static unsigned int timer_tgt_period;
|
static unsigned int timer_tgt_period;
|
||||||
static quint64_t timer_basetime; //used by all clocks to bias them to starting at 0
|
static quint64_t timer_basetime; //used by all clocks to bias them to starting at 0
|
||||||
|
@ -1864,6 +1879,8 @@ static void Sys_InitClock(void)
|
||||||
//calibrate it, and apply.
|
//calibrate it, and apply.
|
||||||
timer_basetime = Sys_GetClock(&freq);
|
timer_basetime = Sys_GetClock(&freq);
|
||||||
Sys_ClockType_Changed(&sys_clocktype, NULL);
|
Sys_ClockType_Changed(&sys_clocktype, NULL);
|
||||||
|
|
||||||
|
Sys_ClockPrecision_Changed(&sys_clocktype, NULL);
|
||||||
}
|
}
|
||||||
double Sys_DoubleTime (void)
|
double Sys_DoubleTime (void)
|
||||||
{
|
{
|
||||||
|
@ -1877,21 +1894,6 @@ unsigned int Sys_Milliseconds (void)
|
||||||
return num / denum;
|
return num / denum;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int sys_interrupt_freq;
|
|
||||||
static void Sys_ClockPrecision_Changed(cvar_t *var, char *oldval)
|
|
||||||
{
|
|
||||||
if (sys_interrupt_freq)
|
|
||||||
timeEndPeriod(sys_interrupt_freq);
|
|
||||||
sys_interrupt_freq = 0;
|
|
||||||
|
|
||||||
if (var && var->ival > 0)
|
|
||||||
{
|
|
||||||
sys_interrupt_freq = var->ival;
|
|
||||||
if (TIMERR_NOERROR != timeBeginPeriod(sys_interrupt_freq))
|
|
||||||
Con_Printf(CON_ERROR"%s: timeBeginPeriod(%u) failed.\n", var->name, sys_interrupt_freq);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Sys_Quit (void)
|
void Sys_Quit (void)
|
||||||
{
|
{
|
||||||
Sys_ClockType_Changed(NULL, NULL);
|
Sys_ClockType_Changed(NULL, NULL);
|
||||||
|
|
Loading…
Reference in a new issue