12-18-2014 02:30 PM
I am using a timer control on the UI to control an event using what I think is relativly standard code(below). The interval is set to 1 second. I have used this for years without problems, but now the program is running on a new computer (Windows 7) and mostly counts down seconds as before, but occassionally something happens and it starts counting down about 1.60 times faster than real time until the program is restarted. I would greatly appreciate any suggestions on what could be happening and how to resolve this.
int CVICALLBACK timerWait (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int waitTime, waitFlag;
char ttt[4];
switch (event)
{
case EVENT_TIMER_TICK:
GetCtrlVal(panelHandle, PANEL_numWaitTime, &waitTime);
waitTime = waitTime - 1;
SetCtrlVal(panelHandle, PANEL_numWaitTime, waitTime);
if (waitTime == 0) {
SetCtrlAttribute(panelHandle, PANEL_timerWait, ATTR_ENABLED, 0);
SetCtrlVal(panelHandle, PANEL_ledWait, 0);
sprintf(ttt, "%d\0", gwaitTime);
Error_LOG(1, ER_ETC_WAIT, 4, 8, ttt);
CmtGetThreadPoolFunctionAttribute(DEFAULT_THREAD_POOL_HANDLE, RunThreadID1, ATTR_TP_FUNCTION_THREAD_HANDLE, &runThreadHandle);
ResumeThread(runThreadHandle);
}
break;
}
return 0;
}
12-29-2014 12:10 AM