Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
clock Class Reference

Read access to the system clock with formatting. More...

Inheritance diagram for clock:
Inheritance graph
[legend]

Public Types

typedef time_t TIME_T
 

Public Member Functions

 clock ()
 Null constructor which stores the start time. More...
 
TIME_T elapsedClockTime () const
 Returns wall-clock time from clock instantiation. More...
 
TIME_T clockTimeIncrement () const
 Returns wall-clock time from last call of clockTimeIncrement() More...
 

Static Public Member Functions

static time_t getTime ()
 Get the current clock time in seconds. More...
 
static const struct tm rawDate ()
 Return the current wall-clock date as a raw struct. More...
 
static string dateTime ()
 Return the current wall-clock date/time as a string. More...
 
static string date ()
 Return the current wall-clock date as a string. More...
 
static string clockTime ()
 Return the current wall-clock time as a string. More...
 

Private Attributes

time_t startTime_
 Start time in seconds. More...
 
time_t lastTime_
 Time when clockTimeIncrement() was last called. More...
 
time_t newTime_
 Latest time from either elapsedClockTime() or clockTimeIncrement() More...
 

Static Private Attributes

static const char * monthNames []
 Names of the months. More...
 

Detailed Description

Read access to the system clock with formatting.

Source files

Definition at line 50 of file clock.H.

Member Typedef Documentation

◆ TIME_T

typedef time_t TIME_T

Definition at line 97 of file clock.H.

Constructor & Destructor Documentation

◆ clock()

clock ( )

Null constructor which stores the start time.

Definition at line 112 of file clock.C.

Member Function Documentation

◆ getTime()

time_t getTime ( )
static

Get the current clock time in seconds.

Definition at line 43 of file clock.C.

◆ rawDate()

const struct tm rawDate ( )
static

Return the current wall-clock date as a raw struct.

Definition at line 49 of file clock.C.

◆ dateTime()

Foam::string dateTime ( )
static

Return the current wall-clock date/time as a string.

format according to ISO-8601 (yyyy-mm-ddThh:mm:ss)

Definition at line 57 of file clock.C.

References Foam::setw().

Referenced by OBJedgeFormat::write().

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

◆ date()

Foam::string date ( )
static

Return the current wall-clock date as a string.

Definition at line 77 of file clock.C.

References Foam::setw().

Referenced by JobInfo::end(), and argList::parse().

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

◆ clockTime()

Foam::string clockTime ( )
static

Return the current wall-clock time as a string.

Definition at line 93 of file clock.C.

References Foam::setw().

Referenced by JobInfo::end(), and argList::parse().

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

◆ elapsedClockTime()

Foam::clock::TIME_T elapsedClockTime ( ) const

Returns wall-clock time from clock instantiation.

Definition at line 122 of file clock.C.

Referenced by main().

Here is the caller graph for this function:

◆ clockTimeIncrement()

Foam::clock::TIME_T clockTimeIncrement ( ) const

Returns wall-clock time from last call of clockTimeIncrement()

Definition at line 129 of file clock.C.

Field Documentation

◆ startTime_

time_t startTime_
private

Start time in seconds.

Definition at line 55 of file clock.H.

◆ lastTime_

time_t lastTime_
mutableprivate

Time when clockTimeIncrement() was last called.

Definition at line 58 of file clock.H.

◆ newTime_

time_t newTime_
mutableprivate

Latest time from either elapsedClockTime() or clockTimeIncrement()

Definition at line 61 of file clock.H.

◆ monthNames

const char * monthNames
staticprivate
Initial value:
=
{
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
}

Names of the months.

Definition at line 64 of file clock.H.


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