clockValue Class Reference

Access to high-resolution clock value with some basic operations. Used to calculate time durations, elapsed times etc. More...

Public Types

typedef std::chrono::high_resolution_clock::duration value_type
 Time structure used. More...
 

Public Member Functions

 clockValue ()
 Construct zero initialized. More...
 
 clockValue (bool)
 Construct with current time. More...
 
 clockValue (const value_type &value)
 Copy construct from duration with the same clock base. More...
 
const value_typevalue () const
 The time duration. More...
 
void clear ()
 Reset to zero. More...
 
void update ()
 Update to the current now() time from the system. More...
 
long seconds () const
 The value in seconds (rounded) More...
 
clockValue elapsed () const
 The time duration elapsed until now() since the start point. More...
 
double elapsedTime () const
 The time elapsed [seconds] until now() since the start point. More...
 
std::string str () const
 Format as day-hh:mm:ss string. More...
 
 operator double () const
 Conversion operator to seconds in floating point. More...
 
clockValueoperator-= (const clockValue &rhs)
 Subtract clock value. More...
 
clockValueoperator+= (const clockValue &rhs)
 Add clock value. More...
 

Static Public Member Functions

static clockValue now ()
 The current clock value from the system. More...
 

Detailed Description

Access to high-resolution clock value with some basic operations. Used to calculate time durations, elapsed times etc.

Source files

Definition at line 53 of file clockValue.H.

Member Typedef Documentation

◆ value_type

typedef std::chrono::high_resolution_clock::duration value_type

Time structure used.

Definition at line 60 of file clockValue.H.

Constructor & Destructor Documentation

◆ clockValue() [1/3]

clockValue ( )
inline

Construct zero initialized.

Definition at line 38 of file clockValueI.H.

Referenced by clockValue::now().

Here is the caller graph for this function:

◆ clockValue() [2/3]

clockValue ( bool  )
inlineexplicit

Construct with current time.

The bool is for tagged dispatch only (its value is ignored).

Definition at line 44 of file clockValueI.H.

◆ clockValue() [3/3]

clockValue ( const value_type value)
inlineexplicit

Copy construct from duration with the same clock base.

Definition at line 50 of file clockValueI.H.

Member Function Documentation

◆ now()

Foam::clockValue now ( )
inlinestatic

The current clock value from the system.

Definition at line 30 of file clockValueI.H.

References clockValue::clockValue().

Referenced by profiling::beginTimer(), clockValue::elapsed(), and profiling::writeData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ value()

const value_type& value ( ) const
inline

The time duration.

Definition at line 95 of file clockValue.H.

Referenced by Foam::operator+(), and Foam::operator-().

Here is the caller graph for this function:

◆ clear()

void clear ( )
inline

Reset to zero.

Definition at line 58 of file clockValueI.H.

◆ update()

void update ( )
inline

Update to the current now() time from the system.

Definition at line 64 of file clockValueI.H.

◆ seconds()

long seconds ( ) const
inline

The value in seconds (rounded)

Definition at line 70 of file clockValueI.H.

◆ elapsed()

Foam::clockValue elapsed ( ) const
inline

The time duration elapsed until now() since the start point.

Definition at line 76 of file clockValueI.H.

References clockValue::now().

Referenced by profiling::endTimer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ elapsedTime()

double elapsedTime ( ) const
inline

The time elapsed [seconds] until now() since the start point.

Definition at line 82 of file clockValueI.H.

◆ str()

std::string str ( ) const

Format as day-hh:mm:ss string.

Definition at line 34 of file clockValue.C.

References os(), Foam::setfill(), and Foam::setw().

Here is the call graph for this function:

◆ operator double()

operator double ( ) const
inline

Conversion operator to seconds in floating point.

Definition at line 90 of file clockValueI.H.

◆ operator-=()

Foam::clockValue & operator-= ( const clockValue rhs)
inline

Subtract clock value.

Definition at line 100 of file clockValueI.H.

◆ operator+=()

Foam::clockValue & operator+= ( const clockValue rhs)
inline

Add clock value.

Definition at line 107 of file clockValueI.H.


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