-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.cpp
More file actions
29 lines (21 loc) · 880 Bytes
/
example.cpp
File metadata and controls
29 lines (21 loc) · 880 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
#include <iostream>
#include <thread>
#include <chrono>
#include "timer.h"
int main (int argc, char* argv[]) {
std::cout << "Remember that it takes a while to carry out print operations."
<< std::endl;
// prints the elapsed time from the start of the program
std::cout << "Current elapsed time (from the start of the program) in nanoseconds: "
<< Timer::elapsed() << std::endl;
// show new elapsed time after sleeping for a second
std::this_thread::sleep_for(std::chrono::seconds(1));
std::cout << "After sleeping for a second, time passed in nanoseconds: " <<
Timer::elapsed() << std::endl;
// reset and print the new time
std::cout << "Resetting the timer..." << std::endl;
Timer::reset();
std::cout << "After reset, elapsed time in nanoseconds: " << Timer::elapsed()
<< std::endl;
return 0;
}