fixed a precision bug that caused SourceMod to stop working after excatly 72.8 hours
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401720
This commit is contained in:
parent
7c95678241
commit
674b877a43
@ -48,16 +48,16 @@ SH_DECL_HOOK2_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
TimerSystem g_Timers;
|
TimerSystem g_Timers;
|
||||||
float g_fUniversalTime = 0.0f;
|
double g_fUniversalTime = 0.0f;
|
||||||
float g_fGameStartTime = 0.0f; /* Game game start time, non-universal */
|
float g_fGameStartTime = 0.0f; /* Game game start time, non-universal */
|
||||||
float g_fTimerThink = 0.0f; /* Timer's next think time */
|
double g_fTimerThink = 0.0f; /* Timer's next think time */
|
||||||
const float *g_pUniversalTime = &g_fUniversalTime;
|
const double *g_pUniversalTime = &g_fUniversalTime;
|
||||||
ConVar *mp_timelimit = NULL;
|
ConVar *mp_timelimit = NULL;
|
||||||
int g_TimeLeftMode = 0;
|
int g_TimeLeftMode = 0;
|
||||||
|
|
||||||
ConVar sm_time_adjustment("sm_time_adjustment", "0", 0, "Adjusts the server time in seconds");
|
ConVar sm_time_adjustment("sm_time_adjustment", "0", 0, "Adjusts the server time in seconds");
|
||||||
|
|
||||||
inline float GetSimulatedTime()
|
inline double GetSimulatedTime()
|
||||||
{
|
{
|
||||||
return g_fUniversalTime;
|
return g_fUniversalTime;
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ private:
|
|||||||
* that a drastic jump in time will continue acting normally. Users
|
* that a drastic jump in time will continue acting normally. Users
|
||||||
* may not expect this, but... I think it is the best solution.
|
* may not expect this, but... I think it is the best solution.
|
||||||
*/
|
*/
|
||||||
inline float CalcNextThink(float last, float interval)
|
inline double CalcNextThink(double last, float interval)
|
||||||
{
|
{
|
||||||
if (g_fUniversalTime - last - interval <= TIMER_MIN_ACCURACY)
|
if (g_fUniversalTime - last - interval <= TIMER_MIN_ACCURACY)
|
||||||
{
|
{
|
||||||
@ -274,7 +274,7 @@ void TimerSystem::RunFrame()
|
|||||||
ITimer *pTimer;
|
ITimer *pTimer;
|
||||||
TimerIter iter;
|
TimerIter iter;
|
||||||
|
|
||||||
float curtime = GetSimulatedTime();
|
double curtime = GetSimulatedTime();
|
||||||
for (iter=m_SingleTimers.begin(); iter!=m_SingleTimers.end(); )
|
for (iter=m_SingleTimers.begin(); iter!=m_SingleTimers.end(); )
|
||||||
{
|
{
|
||||||
pTimer = (*iter);
|
pTimer = (*iter);
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
ITimedEvent *m_Listener;
|
ITimedEvent *m_Listener;
|
||||||
void *m_pData;
|
void *m_pData;
|
||||||
float m_Interval;
|
float m_Interval;
|
||||||
float m_ToExec;
|
double m_ToExec;
|
||||||
int m_Flags;
|
int m_Flags;
|
||||||
bool m_InExec;
|
bool m_InExec;
|
||||||
bool m_KillMe;
|
bool m_KillMe;
|
||||||
@ -103,7 +103,7 @@ private:
|
|||||||
|
|
||||||
time_t GetAdjustedTime(time_t *buf = NULL);
|
time_t GetAdjustedTime(time_t *buf = NULL);
|
||||||
|
|
||||||
extern const float *g_pUniversalTime;
|
extern const double *g_pUniversalTime;
|
||||||
extern TimerSystem g_Timers;
|
extern TimerSystem g_Timers;
|
||||||
extern int g_TimeLeftMode;
|
extern int g_TimeLeftMode;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user