gramods
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
gramods::gmCore::TimeTools Struct Reference

Static functions for converting time. More...

#include <TimeTools.hh>

Public Types

typedef std::chrono::steady_clock clock
 

Static Public Member Functions

static clock::time_point secondsToTimePoint (double s)
 Converts the specified time (in seconds) from epoch to the steady_clock time_point type.
 
static double timePointToSeconds (clock::time_point t)
 Converts the specified time from the steady_clock time_point into seconds from epoch.
 
static double durationToSeconds (clock::duration t)
 Converts the specified duration from the steady_clock duration format into seconds.
 
static clock::duration secondsToDuration (double s)
 Converts the specified time (in seconds) into the steady_clock duration type.
 

Detailed Description

Static functions for converting time.

For example, to find the time in seconds used in a certain call:

typedef gmCore::TimeTools::clock clock;
clock::time_point t0 = clock::now();
expensive_call_to_measure();
clock::time_point t1 = clock::now();
clock::duration time_span = t1 - t0;
std::cerr << "Time used: "
<< std::endl;
static double durationToSeconds(clock::duration t)
Converts the specified duration from the steady_clock duration format into seconds.
Definition TimeTools.cpp:19

Member Function Documentation

◆ durationToSeconds()

double gramods::gmCore::TimeTools::durationToSeconds ( clock::duration  t)
static

Converts the specified duration from the steady_clock duration format into seconds.

◆ secondsToDuration()

TimeTools::clock::duration gramods::gmCore::TimeTools::secondsToDuration ( double  s)
static

Converts the specified time (in seconds) into the steady_clock duration type.

◆ secondsToTimePoint()

TimeTools::clock::time_point gramods::gmCore::TimeTools::secondsToTimePoint ( double  s)
static

Converts the specified time (in seconds) from epoch to the steady_clock time_point type.

◆ timePointToSeconds()

double gramods::gmCore::TimeTools::timePointToSeconds ( clock::time_point  t)
static

Converts the specified time from the steady_clock time_point into seconds from epoch.


The documentation for this struct was generated from the following files: