A couple of things I notice about your code...
First, in your ifyou really needCode:if (SQLInitTimer1 = false) { QueryPerformanceCounter(&SQLStrtTime); SQLInitTimer1 = true; }and instead ofCode:if (SQLInitTimer1 == false)you needCode:else if (SQLInitTimer1 = true)Secondly, in this blockCode:else if (SQLInitTimer1 == true)If the initial state of SQLInitTime1 is not false, you will fall directly into your else if and SQLStartTime has not yet been initialized.Code:if (SQLInitTimer1 == false) { QueryPerformanceCounter(&SQLStrtTime); SQLInitTimer1 = true; } else if (SQLInitTimer1 == true) { QueryPerformanceCounter(&SQLCurrTime); QueryPerformanceFrequency(&SQLFreq); SQLDiff = ((double)(SQLCurrTime.QuadPart - SQLStrtTime.QuadPart) / (double)(SQLFreq.QuadPart)) * 1000; if (SQLDiff >= 500) { UpdateSQL(); SQLInitTimer1 = false; } }
Hope that helps.
PS - Indentation and the use of code tags would really help you see the flow.




Reply With Quote