namespace time_m

Overview

Set of functions and structures for measuring time. More…

namespace time_m {

// typedefs

typedef std::chrono::system_clock::time_point DateTime;

// structs

template <typename T>
struct ProfilingResult;

// classes

class FPSCounter;
class FileTimeLogger;
class StopWatch;
class TimeLogger;

// global functions

DateTime Now();
double NowMs();
double NowS();
std::string ToString(const DateTime& date_time, const std::string& format = "%Y_%m_%d_%H_%M_%S");
std::string NowStr(const std::string& format = "%Y_%m_%d_%H_%M_%S");
int64_t MicrosecondsBetween(const DateTime& datetime1, const DateTime& datetime2);
double SecondsBetween(const DateTime& datetime1, const DateTime& datetime2);

template <typename T>
ProfilingResult<T> ProfileFunctionRun(std::function<T()> Function);

} // namespace time_m

Detailed Documentation

Set of functions and structures for measuring time.

Global 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.

Parameters:

date_time

The DateTime to be formatted.

format

Defines string format. For options see documentation of strftime() at https://en.cppreference.com/w/c/chrono/strftime.

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

Returns current time in string form.

Parameters:

format

Defines string format. For options see documentation of strftime() at https://en.cppreference.com/w/c/chrono/strftime.

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.