Time Shield Library
2.0.0
C++ library for working with time
Loading...
Searching...
No Matches
time_utils_example.cpp
Go to the documentation of this file.
1
6
7
#include <iostream>
8
9
#include <
time_shield/core/time_utils.hpp
>
10
11
int
main
() {
12
using namespace
time_shield
;
13
14
// Print different representations of the current time
15
std::cout <<
"Seconds since epoch: "
<< ts() <<
'\n'
;
16
std::cout <<
"Milliseconds since epoch: "
<< ts_ms() <<
'\n'
;
17
std::cout <<
"Microseconds since epoch: "
<< ts_us() <<
'\n'
;
18
19
// Show fractional parts of the current second
20
std::cout <<
"Nanosecond part: "
<< ns_of_sec() <<
'\n'
;
21
std::cout <<
"Microsecond part: "
<< us_of_sec() <<
'\n'
;
22
std::cout <<
"Millisecond part: "
<< ms_of_sec() <<
'\n'
;
23
24
std::cout <<
"CPU time used: "
<< get_cpu_time() <<
" s"
<<
'\n'
;
25
std::cout <<
"Realtime (us): "
<< now_realtime_us() <<
'\n'
;
26
27
std::cout <<
"Press Enter to exit..."
<< std::endl;
28
std::cin.get();
29
return
0;
30
}
time_shield
Main namespace for the Time Shield library.
time_utils.hpp
Header file with time-related utility functions.
main
int main()
Definition
time_utils_example.cpp:11
examples
time_utils_example.cpp
Generated by
1.12.0