Utilities
Utilities header only library
time_m Namespace Reference

Set of functions and structures for measuring time. More...

Data Structures

class  FileTimeLogger
 Measures duration of program parts and logs times into a file. More...
 
struct  ProfilingResult
 The result of profiling function execution. Contains the actual result and the run time. More...
 
class  StopWatch
 Class for measuring time in milliseconds [ms]. More...
 
class  TimeLogger
 Measures duration of program parts and logs times into a stream. More...
 

Typedefs

using DateTime = std::chrono::system_clock::time_point
 

Functions

DateTime Now ()
 Returns current time point.
 
double NowMs ()
 Returns current time, as number of milliseconds since epoch start.
 
double NowS ()
 Returns current time, as number of seconds since epoch start.
 
std::string ToString (const DateTime &date_time, const std::string &format="%Y_%m_%d_%H_%M_%S")
 Returns specified time in string form. More...
 
std::string NowStr (const std::string &format="%Y_%m_%d_%H_%M_%S")
 Returns current time in string form. More...
 
int64_t MicrosecondsBetween (const DateTime &datetime1, const DateTime &datetime2)
 Returns duration between two time points in microseconds.
 
double SecondsBetween (const DateTime &datetime1, const DateTime &datetime2)
 Returns duration between two time points in seconds.
 
template<typename T >
ProfilingResult< T > ProfileFunctionRun (std::function< T()> Function)
 Execute and profile a function.
 

Detailed Description

Set of functions and structures for measuring time.

Function Documentation

◆ NowStr()

std::string time_m::NowStr ( const std::string &  format = "%Y_%m_%d_%H_%M_%S")
inline

Returns current time in string form.

Parameters
formatDefines string format. For options see documentation of strftime() at https://en.cppreference.com/w/c/chrono/strftime.
Here is the call graph for this function:

◆ ToString()

std::string time_m::ToString ( const DateTime &  date_time,
const std::string &  format = "%Y_%m_%d_%H_%M_%S" 
)
inline

Returns specified time in string form.

Parameters
date_timeThe DateTime to be formatted.
formatDefines string format. For options see documentation of strftime() at https://en.cppreference.com/w/c/chrono/strftime.
Here is the caller graph for this function: