-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdemo.cpp
58 lines (39 loc) · 935 Bytes
/
demo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <stdio.h>
#include "CppTimer.h"
#include <unistd.h>
#include <time.h>
#include <thread>
class DemoTimer1 : public CppTimer {
void timerEvent() {
fprintf(stdout,"Buh! ");
fflush(stdout);
}
};
class DemoTimer2 : public CppTimer {
void timerEvent() {
fprintf(stdout,"Bah!!!!!!\n");
}
};
class DemoTimer3 : public CppTimer {
void timerEvent() {
fprintf(stdout,"Booom!!!!!!\n");
}
};
int main( int, const char**) {
DemoTimer1 demoTimer1;
demoTimer1.startms(250);
DemoTimer2 demoTimer2;
demoTimer2.startms(1000);
DemoTimer3 demoTimer3;
demoTimer3.startms(1000,ONESHOT);
std::this_thread::sleep_for(std::chrono::seconds(2));
demoTimer1.stop();
demoTimer2.stop();
std::this_thread::sleep_for(std::chrono::seconds(1));
demoTimer1.startns(25000000);
demoTimer2.startns(100000000);
std::this_thread::sleep_for(std::chrono::seconds(1));
demoTimer1.stop();
demoTimer2.stop();
return 0;
}