forked from berndporr/cppTimer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.cpp
More file actions
47 lines (32 loc) · 789 Bytes
/
demo.cpp
File metadata and controls
47 lines (32 loc) · 789 Bytes
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
#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");
}
};
int main( int argc, const char* argv[] ) {
DemoTimer1 demoTimer1;
demoTimer1.start(250000000);
DemoTimer2 demoTimer2;
demoTimer2.start(1000000000);
std::this_thread::sleep_for(std::chrono::seconds(2));
demoTimer1.stop();
demoTimer2.stop();
std::this_thread::sleep_for(std::chrono::seconds(1));
demoTimer1.start(25000000);
demoTimer2.start(100000000);
std::this_thread::sleep_for(std::chrono::seconds(1));
demoTimer1.stop();
demoTimer2.stop();
return 0;
}