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.