[Xapian-discuss] Omega is fast, but not THAT fast
Dan Carpenter
error27 at gmail.com
Tue Aug 8 04:22:52 BST 2006
On 8/6/06, Jeff Breidenbach <breidenbach at gmail.com> wrote:
> >Search took -125.376129 seconds
>
> I double checked with a handheld stopwatch, and at no
> point did the hands spin backwards.
>
> Known problem?
Here's the code that sets that up in 0.9.6. It's in query.cc. It
depends on what platform you're running the code on. Probably you
have gettimeofday() I'm guessing...
#ifdef HAVE_GETTIMEOFDAY
if (gettimeofday(&tv, 0) == 0) {
sec = tv.tv_sec - sec;
usec = tv.tv_usec - usec;
if (usec < 0) {
--sec;
usec += 1000000;
}
} else {
usec = -1;
}
#elif defined(FTIME_RETURNS_VOID)
struct timeb tp;
ftime(&tp);
sec = tp.time - sec;
usec = tp.millitm * 1000 - usec;
if (usec < 0) {
--sec;
usec += 1000000;
}
#elif defined(HAVE_FTIME)
struct timeb tp;
if (ftime(&tp) == 0) {
sec = tp.time - sec;
usec = tp.millitm * 1000 - usec;
if (usec < 0) {
--sec;
usec += 1000000;
}
} else {
usec = -1;
}
#else
usec = time(NULL);
if (usec != -1) {
sec = sec - usec;
usec = 0;
}
#endif
It actually sets sec and usec earlier but the code is similar.
By coincidence I've been looking into some issues with system time
going backwards recently. Is there anyway you could run this for 30
seconds:
"while true ; do date ; done | uniq -c". Probably your system clock
is fine but I'm paranoid right now.
regards,
dan carpenter
More information about the Xapian-discuss
mailing list