4 #include <windows.h> |
4 #include <windows.h> |
5 |
5 |
6 void timer_notify() |
6 void timer_notify() |
7 { |
7 { |
8 struct _timeb timebuffer; |
8 struct _timeb timebuffer; |
|
9 printf("."); |
9 |
10 |
10 _ftime( &timebuffer ); |
11 _ftime( &timebuffer ); |
11 CURRENT_TIME.tv_sec = timebuffer.time; |
12 __CURRENT_TIME.tv_sec = timebuffer.time; |
12 CURRENT_TIME.tv_nsec = timebuffer.millitm * 1000000 |
13 __CURRENT_TIME.tv_nsec = timebuffer.millitm * 1000000; |
13 __run(); |
14 __run(); |
14 } |
15 } |
15 |
16 |
16 int main(int argc,char **argv) |
17 int main(int argc,char **argv) |
17 { |
18 { |
18 HANDLE hTimer = NULL; |
19 HANDLE hTimer = NULL; |
19 LARGE_INTEGER liDueTime; |
20 LARGE_INTEGER liDueTime; |
20 |
21 |
21 liDueTime.QuadPart = -10000 * maxval(common_ticktime__,1);; |
22 liDueTime.QuadPart = -10000 * maxval(common_ticktime__,1); |
22 |
23 |
23 // Create a waitable timer. |
24 // Create a waitable timer. |
24 hTimer = CreateWaitableTimer(NULL, TRUE, "WaitableTimer"); |
25 hTimer = CreateWaitableTimer(NULL, FALSE, "WaitableTimer"); |
25 if (NULL == hTimer) |
26 if (NULL == hTimer) |
26 { |
27 { |
27 printf("CreateWaitableTimer failed (%d)\n", GetLastError()); |
28 printf("CreateWaitableTimer failed (%d)\n", GetLastError()); |
28 return 1; |
29 return 1; |
29 } |
30 } |
30 |
31 |
31 if( __init(argc,argv) == 0 ){ |
32 if( __init(argc,argv) == 0 ){ |
32 |
33 |
|
34 printf("Tick Time : %d ms\n", common_ticktime__); |
33 // Set a timer |
35 // Set a timer |
34 if (!SetWaitableTimer(hTimer, &liDueTime, common_ticktime__, NULL, NULL, 0)) |
36 if (!SetWaitableTimer(hTimer, &liDueTime, common_ticktime__, NULL, NULL, 0)) |
35 { |
37 { |
36 printf("SetWaitableTimer failed (%d)\n", GetLastError()); |
38 printf("SetWaitableTimer failed (%d)\n", GetLastError()); |
37 return 2; |
39 return 2; |