emmanuel.duru@atosorigin.com wrote:
I am running windows 32 bits. Here is what I get from my debugging session: After QueryPerformanceCounter(&count ), count.QuadPart is worth 4243738405535005 So the overflow comes from count.QuadPart *= 1000000;
I see. There's no reason we should be computing against the full value of the count; since we're only looking for the microsecond portion we should have stripped off everything greater. (E.g., count.QuadPart %= cFreq.QuadPart).
I'll have to play with this code a bit more, there's probably a better way to isolate the microseconds.
PS: I guess that means your Windows machine had an uptime of several days. Quite impressive, for Windows... ;)
-----Message d'origine----- De : Howard Chu [mailto:hyc@symas.com] Envoyé : mercredi 27 août 2008 13:08 À : openldap-its@openldap.org; Emmanuel Duru Objet : Re: (ITS#5668) Invalid entryCSN generated, and slapd will not restart
ando@sys-net.it wrote:
emmanuel.duru@atosorigin.com wrote:
I see that tm->tm_usub is negative, there seems to be overflows between LARGE_INTEGER and int variables.
It would take over 4 billion operations in a single timer tick (on the order of nanoseconds) to make tm_usub overflow. That seems pretty unlikely.
If the problem disappears by initializing the static variables in lutil_gettime(), then it might be a compiler issue.
I suppose that's always possible...
The original post shows that the tm_usec field is negative. That could happen if the offset we computed between the SYSTEMTIME and the PerformanceCounter was wrong, or if the SYSTEMTIME was adjusted while the process was running.
What version of Windows are you running? 32 or 64 bit? Can you singlestep through this function with a debugger and verify all of the values? I haven't run this code on Windows in a long time, would take a bit of effort to resurrect my build environment.
-- -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/