[bug] Divide by zero in juce_millisecondsSinceStartup


#1

I am getting a divide by zero here:

uint32 juce_millisecondsSinceStartup()
{
    LARGE_INTEGER ticks;
    QueryPerformanceCounter (&ticks);
    return (uint32) ((ticks.QuadPart * 1000) / hiResTicksPerSecond);
}

Strangely this just started happening after I moved to using boost::shared_ptr for my components, constructing them inside the parent component’s ctor initialization list.

It wasn’t happening before. But in any case, hiResTicksPerSecond is showing as 0 when this function is called.


#2

Well your code’s obviously being calling before the Juce startup code has executed - maybe a static object is being doing this in its constructor before the application has had chance to initialise?


#3

Yeah, I’ll take a closer look. Thx.


#4