diff -r d376a8b0b602 -r 2db8b87016a0 targets/Win32/plc_Win32_main.c --- a/targets/Win32/plc_Win32_main.c Wed Feb 15 00:44:24 2012 +0100 +++ b/targets/Win32/plc_Win32_main.c Wed Feb 15 16:39:56 2012 +0100 @@ -38,7 +38,7 @@ /* arg 2 of SetWaitableTimer take 100 ns interval*/ liDueTime.QuadPart = next / (-100); - if (!SetWaitableTimer(PLC_timer, &liDueTime, period/1000000, NULL, NULL, 0)) + if (!SetWaitableTimer(PLC_timer, &liDueTime, period<1000000?1:period/1000000, NULL, NULL, 0)) { printf("SetWaitableTimer failed (%d)\n", GetLastError()); } @@ -116,6 +116,7 @@ /* Create a waitable timer */ + timeBeginPeriod(1); PLC_timer = CreateWaitableTimer(NULL, FALSE, "WaitableTimer"); if(NULL == PLC_timer) {