Emeric Vigier | 2f62582 | 2012-08-06 11:09:52 -0400 | [diff] [blame] | 1 | |
2 | #include <cc++/thread.h> | ||||
3 | #include <cstdio> | ||||
4 | |||||
5 | #ifdef CCXX_NAMESPACES | ||||
6 | using namespace std; | ||||
7 | using namespace ost; | ||||
8 | #endif | ||||
9 | |||||
10 | |||||
11 | int main(int argc, char* argv[]) | ||||
12 | { | ||||
13 | TimerPort timer; | ||||
14 | unsigned i = 12; | ||||
15 | time_t now, start; | ||||
16 | |||||
17 | time(&start); | ||||
18 | timer.setTimer(); | ||||
19 | fflush(stdout); | ||||
20 | while(i--) { | ||||
21 | timer.incTimer(250); | ||||
22 | Thread::sleep(250); | ||||
23 | printf("!"); | ||||
24 | fflush(stdout); | ||||
25 | } | ||||
26 | time(&now); | ||||
27 | printf("%ld", now - start); | ||||
28 | for(;;) { | ||||
29 | timer.incTimer(100); | ||||
30 | timer.sleepTimer(); | ||||
31 | printf("."); | ||||
32 | fflush(stdout); | ||||
33 | } | ||||
34 | return 0; | ||||
35 | } | ||||
36 |