patch: [#27783] "Problem with clock" at 18:39:00 by Daniel Dionne (mrzeon)

the overflow of the clock was causing crash in the game engine in Linux.
(on June 11 2011, 18:39:00 GMT)

running to the "where is waldo (wally)" bug award of 2011.
This commit is contained in:
Dalai Felinto 2011-07-18 22:28:42 +00:00
parent 7de78a812c
commit 1f5d60ba01

@ -150,8 +150,9 @@ GHOST_SystemX11(
if (gettimeofday(&tv,NULL) == -1) {
GHOST_ASSERT(false,"Could not instantiate timer!");
}
m_start_time = GHOST_TUns64(tv.tv_sec*1000 + tv.tv_usec/1000);
// Taking care not to overflow the tv.tv_sec*1000
m_start_time = GHOST_TUns64(tv.tv_sec)*1000 + tv.tv_usec/1000;
/* use detectable autorepeate, mac and windows also do this */
@ -199,7 +200,8 @@ getMilliSeconds(
GHOST_ASSERT(false,"Could not compute time!");
}
return GHOST_TUns64(tv.tv_sec*1000 + tv.tv_usec/1000) - m_start_time;
// Taking care not to overflow the tv.tv_sec*1000
return GHOST_TUns64(tv.tv_sec)*1000 + tv.tv_usec/1000 - m_start_time;
}
GHOST_TUns8