-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (27 loc) · 914 Bytes
/
main.cpp
File metadata and controls
33 lines (27 loc) · 914 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
/******************************************************************************
* File Name: main.cpp
* Description: Driver code to test the Timer
* Notes:
* Author: Aseem Tiwari
* Date: 10/02/2021
******************************************************************************/
#include <iostream>
#include "timer.hpp"
// Event handler
void WhenTimerExpire()
{
std::cout << "myTimer expired!! " << "\n";
}
// Driver code to test timer
int main()
{
Timer myTimer(3000UL, &WhenTimerExpire, true);
myTimer.Start();
// std::this_thread::sleep_for(std::chrono::seconds(121));
// Test2: Stop the timer after 7 secs but main thread should still be running.
std::this_thread::sleep_for(std::chrono::seconds(13));
myTimer.Stop();
myTimer.Restart(5000UL);
std::this_thread::sleep_for(std::chrono::milliseconds(25005));
return 0;
}