struct _timeb timebuffer;
if(++localcount % 50 == 0){
printf("PLC tick : %d\n",localcount);
__CURRENT_TIME.tv_sec = timebuffer.time;
__CURRENT_TIME.tv_nsec = timebuffer.millitm * 1000000;
int main(int argc,char **argv)
liDueTime.QuadPart = -10000 * maxval(common_ticktime__,1);
// Create a waitable timer.
hTimer = CreateWaitableTimer(NULL, FALSE, "WaitableTimer");
printf("CreateWaitableTimer failed (%d)\n", GetLastError());
if( __init(argc,argv) == 0 ){
printf("Tick Time : %d ms\n", common_ticktime__);
if (!SetWaitableTimer(hTimer, &liDueTime, common_ticktime__, NULL, NULL, 0))
printf("SetWaitableTimer failed (%d)\n", GetLastError());
if (WaitForSingleObject(hTimer, INFINITE) != WAIT_OBJECT_0)
printf("WaitForSingleObject failed (%d)\n", GetLastError());