AiLibrary  v1.3.0
A single-header C++ Library from Ailurus Studio
Time Functions

Functions providing methods to measure time. More...

Functions

INLINE std::chrono::high_resolution_clock::time_point ai::time ()
 Returns current time point. More...
 
INLINE std::chrono::system_clock::time_point ai::systemTime ()
 Returns current time point. More...
 
INLINE double ai::duration (const std::chrono::high_resolution_clock::time_point start, const std::chrono::high_resolution_clock::time_point finish, const std::string scale=std::string("ms"))
 
INLINE double ai::duration (const std::chrono::high_resolution_clock::time_point start, const std::string scale=std::string("ms"))
 
INLINE void ai::printDuration (const std::chrono::high_resolution_clock::time_point start, const std::chrono::high_resolution_clock::time_point finish, const std::string scale=std::string("ms"), const std::size_t count=0)
 
INLINE void ai::printDuration (const std::chrono::high_resolution_clock::time_point start, const std::string scale=std::string("ms"), const std::size_t count=0)
 
INLINE std::string ai::getDateAndTime (std::chrono::system_clock::time_point timePoint=std::chrono::system_clock::now())
 Get date and time. More...
 
INLINE std::string ai::getDate (std::chrono::system_clock::time_point timePoint=std::chrono::system_clock::now())
 Get date. More...
 
INLINE std::string ai::getTime (std::chrono::system_clock::time_point timePoint=std::chrono::system_clock::now())
 Get time. More...
 

Detailed Description

Group of functions that is in help when you need to measure execution time of some code section

Function Documentation

◆ duration() [1/2]

INLINE double ai::duration ( const std::chrono::high_resolution_clock::time_point  start,
const std::chrono::high_resolution_clock::time_point  finish,
const std::string  scale = std::string("ms") 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ duration() [2/2]

INLINE double ai::duration ( const std::chrono::high_resolution_clock::time_point  start,
const std::string  scale = std::string("ms") 
)
Here is the call graph for this function:

◆ getDate()

std::string ai::getDate ( std::chrono::system_clock::time_point  timePoint = std::chrono::system_clock::now())

This function converts the given moment to std::string containing the passed date

Parameters
timePointOptional. The moment on the system clock to be converted, the current time by default
Returns
std::string with date in the format yyyy.mm.dd

◆ getDateAndTime()

std::string ai::getDateAndTime ( std::chrono::system_clock::time_point  timePoint = std::chrono::system_clock::now())

This function converts the given moment to std::string containing the passed date and time

Parameters
timePointOptional. The moment on the system clock to be converted, the current time by default
Returns
std::string with date and time in the format yyyy.mm.dd HH:MM:SS
Here is the caller graph for this function:

◆ getTime()

std::string ai::getTime ( std::chrono::system_clock::time_point  timePoint = std::chrono::system_clock::now())

This function converts the given moment to std::string containing the passed time

Parameters
timePointOptional. The moment on the system clock to be converted, the current time by default
Returns
std::string with date time in the format HH:MM:SS

◆ printDuration() [1/2]

INLINE void ai::printDuration ( const std::chrono::high_resolution_clock::time_point  start,
const std::chrono::high_resolution_clock::time_point  finish,
const std::string  scale = std::string("ms"),
const std::size_t  count = 0 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ printDuration() [2/2]

INLINE void ai::printDuration ( const std::chrono::high_resolution_clock::time_point  start,
const std::string  scale = std::string("ms"),
const std::size_t  count = 0 
)
Here is the call graph for this function:

◆ systemTime()

std::chrono::system_clock::time_point ai::systemTime ( )

This function returns current time point using std::chrono

Returns
std::chrono::system_clock entity

◆ time()

std::chrono::high_resolution_clock::time_point ai::time ( )

This function returns current time point using std::chrono

Returns
std::chrono::high_resolution_clock entity
Here is the caller graph for this function: