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 49 of file clockValue.H.

Member Typedef Documentation

◆ value_type

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

Time structure used.

Definition at line 58 of file clockValue.H.

Constructor & Destructor Documentation

◆ clockValue() [1/3]

clockValue ( )
inline

Construct zero initialized.

Definition at line 31 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 37 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 43 of file clockValueI.H.

Member Function Documentation

◆ now()

Foam::clockValue now ( )
inlinestatic

The current clock value from the system.

Definition at line 23 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 106 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 51 of file clockValueI.H.

◆ update()

void update ( )
inline

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

Definition at line 57 of file clockValueI.H.

◆ seconds()

long seconds ( ) const
inline

The value in seconds (rounded)

Definition at line 63 of file clockValueI.H.

References Foam::BitOps::count().

Here is the call graph for this function:

◆ elapsed()

Foam::clockValue elapsed ( ) const
inline

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

Definition at line 69 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 75 of file clockValueI.H.

◆ str()

std::string str ( ) const

Format as day-hh:mm:ss string.

Definition at line 27 of file clockValue.C.

References Foam::BitOps::count(), 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 83 of file clockValueI.H.

◆ operator-=()

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

Subtract clock value.

Definition at line 93 of file clockValueI.H.

◆ operator+=()

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

Add clock value.

Definition at line 100 of file clockValueI.H.


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