[ut3] Shutdown Error
Martin Zwickel
martin.zwickel at technotrend.de
Thu Dec 20 03:41:26 EST 2007
Hi Ryan,
On Wed, 19 Dec 2007 14:58:23 -0500
"Ryan C. Gordon" <icculus at icculus.org> bubbled:
>
> > appError called:
> >
> > Detected negative delta time - on AMD systems please install
>
> Is it possible that your system clock adjusted? Like an ntp daemon moved
> it back a couple of seconds?
>
> On Windows, this error is due to the rdtsc not being reliable on
> multicore systems (and a patch from AMD to fix it), but we use
> gettimeofday() on Linux to decide how much time has elapsed between ticks.
gettimeofday() is a bad idea when it's about critical time information...
Especially when it's about system time change.
times() would be much more accurate.
Something like:
[code]
#ifndef int64_t
#warning int64_t not defined, defining it as (signed long long)
#define int64_t signed long long
#endif
#ifndef CLK_TCK
#define CLK_TCK clk_tck
static unsigned long clk_tck = 0;
#define INIT_CLK_TCK() do { \
if(!clk_tck) { \
clk_tck = sysconf(_SC_CLK_TCK); \
} } while(0)
#else
#define INIT_CLK_TCK()
#endif
static inline int64_t GetAbsoluteTimeInMilliSeconds(void)
{
struct tms currentTimes;
clock_t ticks;
ticks = times(¤tTimes);
if(ticks == -1) {
return -1;
}
INIT_CLK_TCK();
return (int64_t)ticks * (1000LL / (int64_t)CLK_TCK);
}
[/code]
Regards,
Martin
--
MyExcuse:
Vendor no longer supports the product
Martin Zwickel <martin.zwickel at technotrend.de>
Research & Development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://icculus.org/pipermail/ut3/attachments/20071220/7cdee64a/attachment.pgp>
More information about the ut3
mailing list