Skip to content

A C++ library used for timing code and formatting time.

License

Notifications You must be signed in to change notification settings

UnexomWid/timerh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

About C++ 17

TimerH is a compact C++ library used for timing code and formatting time. It supports precision up to a nanosecond.

License License: MIT

TimerH was created by UnexomWid. It is licensed under the MIT license.

Usage

CHRONOMETER ch;
ch = time_now();
/*
 Code to time.
*/
std::cout << "Execution Time (milliseconds): " << get_exec_time_ms(ch) << " ms";
std::cout << "\nExecution Time (formatted, nanoseconds): " << getf_exec_time_ns(ch);

Example of output:

Execution Time: 1 ms
Execution Time (formatted): 1 millisecond, 14 microseconds, 695 nanoseconds

Definitions

Name Value
CHRONOMETER std::chrono::high_resolution_clock::time_point

Functions

Function Description
time_now() Gets the current time, as a CHRONOMETER object
get_exec_time_ns(CHRONOMETER) Gets the execution time in nanoseconds
get_exec_time_mis(CHRONOMETER) Gets the execution time in microseconds
get_exec_time_ms(CHRONOMETER) Gets the execution time in milliseconds
get_exec_time_s(CHRONOMETER) Gets the execution time in seconds
get_exec_time_m(CHRONOMETER) Gets the execution time in minutes
get_exec_time_h(CHRONOMETER) Gets the execution time in hours
format_time_ns(uint64_t) Formats a number representing nanoseconds as a string
format_time_mis(uint64_t) Formats a number representing microseconds as a string
format_time_ms(uint64_t) Formats a number representing milliseconds as a string
getf_exec_time_ns(CHRONOMETER) Gets the formatted execution time with the precision of a nanosecond
getf_exec_time_mis(CHRONOMETER) Gets the formatted execution time with the precision of a microsecond
getf_exec_time_ms(CHRONOMETER) Gets the formatted execution time with the precision of a millisecond

About

A C++ library used for timing code and formatting time.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages