Public Member Functions | Protected Attributes | Friends
ecl::TimeStampBase Class Reference

This class provides common functionality across platforms for the timestamps. More...

#include <timestamp_base.hpp>

List of all members.

Public Member Functions

long msec () const
 Milliseconds component (after removing seconds).
long nsec () const
 Nanoseconds component (after removing seconds).
 operator double () const
 Disguises the timestamp as a regular double.
bool operator!= (const TimeStampBase &time_stamp)
TimeStampBase operator+ (const TimeStampBase &time_stamp)
void operator+= (const TimeStampBase &time_stamp)
TimeStampBase operator- (const TimeStampBase &time_stamp) ecl_assert_throw_decl(StandardException)
void operator-= (const TimeStampBase &time_stamp) ecl_assert_throw_decl(StandardException)
bool operator< (const TimeStampBase &time_stamp)
bool operator<= (const TimeStampBase &time_stamp)
bool operator== (const TimeStampBase &time_stamp)
bool operator> (const TimeStampBase &time_stamp)
bool operator>= (const TimeStampBase &time_stamp)
long sec () const
 Seconds component.
const TimeStampBasestamp (const double &decimal_time_value) ecl_assert_throw_decl(StandardException)
 Manually set the timestamp.
const TimeStampBasestamp (const time_t &seconds, const long &nanoseconds) ecl_assert_throw_decl(StandardException)
 Manually sets the timestamp with the specified values.
 TimeStampBase ()
 TimeStampBase (const double &decimal_time_value) ecl_assert_throw_decl(StandardException)
 Default constructor.
 TimeStampBase (const time_t &seconds, const long &nanoseconds) ecl_assert_throw_decl(StandardException)
 Initialises the timestamp with the specified sec/nsec pair.
long usec () const
 Microseconds component (after removing seconds).
virtual ~TimeStampBase ()

Protected Attributes

TimeStructure time

Friends

template<typename OutputStream >
OutputStream & operator<< (OutputStream &ostream, const TimeStampBase &time_stamp)

Detailed Description

This class provides common functionality across platforms for the timestamps.

Most of the operations on a timestamp class is common from one platform to the next. These functions are bundled together in this class.

Definition at line 39 of file timestamp_base.hpp.


Constructor & Destructor Documentation

ecl::TimeStampBase::TimeStampBase ( ) [inline, explicit]

Definition at line 44 of file timestamp_base.hpp.

ecl::TimeStampBase::TimeStampBase ( const double &  decimal_time_value) [explicit]

Default constructor.

Initialise the timestamp with a default value.

Initialises the timestamp with the specified double value. Note that this is slower than the manual initialisation with a sec/nsec pair.

Parameters:
decimal_time_value: time units in seconds (integral part) and nanoseconds (decimal part).
Exceptions:
StandardException: throws if the input arguments is not positive [debug mode only].

Definition at line 27 of file timestamp_base.cpp.

ecl::TimeStampBase::TimeStampBase ( const time_t &  seconds,
const long &  nanoseconds 
)

Initialises the timestamp with the specified sec/nsec pair.

This is the fastest means of initialisation to a set time value.

Parameters:
seconds: discrete time value measured in whole seconds.
nanoseconds: fraction of a second measured in nanoseconds.
Exceptions:
StandardException: throws if input arguments are not positive [debug mode only].

Definition at line 34 of file timestamp_base.cpp.

virtual ecl::TimeStampBase::~TimeStampBase ( ) [inline, virtual]

Definition at line 67 of file timestamp_base.hpp.


Member Function Documentation

long ecl::TimeStampBase::msec ( ) const [inline]

Milliseconds component (after removing seconds).

Get the fractional number of milliseconds recorded in this timestamp.

Returns:
long : the fractional amount of time recorded by this timestamp (in ms).

Definition at line 111 of file timestamp_base.hpp.

long ecl::TimeStampBase::nsec ( ) const [inline]

Nanoseconds component (after removing seconds).

Get the fractional number of nanoseconds recorded in this timestamp.

Returns:
long : the fractional amount of time recorded by this timestamp (in ns).

Definition at line 125 of file timestamp_base.hpp.

ecl::TimeStampBase::operator double ( ) const [inline]

Disguises the timestamp as a regular double.

Converts the posix timespec structure to a double (seconds->integral part, nanoseconds->fractional part). This is sometimes useful in time calculations.

Definition at line 133 of file timestamp_base.hpp.

bool ecl::TimeStampBase::operator!= ( const TimeStampBase time_stamp)

Inequality operator.

Parameters:
time_stamp: the rhv (timestamp) to be compared to this instance.
Returns:
bool : the result of the comparison operation.

Definition at line 70 of file timestamp_base.cpp.

TimeStampBase ecl::TimeStampBase::operator+ ( const TimeStampBase time_stamp)

Sum operator that returns a new timestamp holding the sum.

Parameters:
time_stamp: the rhv (timestamp to be added to this instance).
Returns:
TimeStamp : the sum of the two timestamps.

Definition at line 134 of file timestamp_base.cpp.

void ecl::TimeStampBase::operator+= ( const TimeStampBase time_stamp)

Sum operator that modifies this instance with the result.

Parameters:
time_stamp: the rhv (timestamp to be added to this instance).

Definition at line 125 of file timestamp_base.cpp.

TimeStampBase ecl::TimeStampBase::operator- ( const TimeStampBase time_stamp)

Difference operator that returns a new timestamp holding the difference. Note that a difference that would result in a negative timestamp is not permitted (design requirement). Subsequently, this method will throw when in debug mode if this situation occurs.

Parameters:
time_stamp: the rhv (timestamp to be subtracted from this instance).
Returns:
TimeStamp : the difference of the two timestamps.
Exceptions:
StandardException: throws if difference would create a negative timestamp [debug mode only].

Definition at line 158 of file timestamp_base.cpp.

void ecl::TimeStampBase::operator-= ( const TimeStampBase time_stamp)

Difference operator that modifies this instance with the result. Note that a difference that would result in a negative timestamp is not permitted (design requirement). Subsequently, this method will throw when in debug mode if this situation occurs.

Parameters:
time_stamp: the rhv (timestamp to be subtracted from this instance).
Exceptions:
StandardException: throws if difference would create a negative timestamp [debug mode only].

Definition at line 144 of file timestamp_base.cpp.

bool ecl::TimeStampBase::operator< ( const TimeStampBase time_stamp)

Less than operator.

Parameters:
time_stamp: the rhv (timestamp) to be compared to this instance.
Returns:
bool : the result of the comparison operation.

Definition at line 100 of file timestamp_base.cpp.

bool ecl::TimeStampBase::operator<= ( const TimeStampBase time_stamp)

Less than or equal to operator.

Parameters:
time_stamp: the rhv (timestamp) to be compared to this instance.
Returns:
bool : the result of the comparison operation.

Definition at line 78 of file timestamp_base.cpp.

bool ecl::TimeStampBase::operator== ( const TimeStampBase time_stamp)

Equality operator.

Parameters:
time_stamp: the rhv (timestamp) to be compared to this instance.
Returns:
bool : the result of the comparison operation.

Definition at line 62 of file timestamp_base.cpp.

bool ecl::TimeStampBase::operator> ( const TimeStampBase time_stamp)

Greater than or equal to operator.

Parameters:
time_stamp: the rhv (timestamp) to be compared to this instance.
Returns:
bool : the result of the comparison operation.

Definition at line 111 of file timestamp_base.cpp.

bool ecl::TimeStampBase::operator>= ( const TimeStampBase time_stamp)

Greater than or equal to operator.

Parameters:
time_stamp: the rhv (timestamp) to be compared to this instance.
Returns:
bool : the result of the comparison operation.

Definition at line 89 of file timestamp_base.cpp.

long ecl::TimeStampBase::sec ( ) const [inline]

Seconds component.

Get the current number of whole seconds recorded by this timestamp.

Returns:
Seconds : the number of whole seconds recorded by this timestamp.

Definition at line 104 of file timestamp_base.hpp.

const TimeStampBase & ecl::TimeStampBase::stamp ( const double &  decimal_time_value)

Manually set the timestamp.

Manually sets the timestamp with the specified double value. Note that this is slower than the stamp with a sec/nsec pair.

Parameters:
decimal_time_value: time units in seconds (integral part) and nanoseconds (decimal part).
Exceptions:
StandardException: throws if the input arguments is not positive [debug mode only].

Definition at line 44 of file timestamp_base.cpp.

const TimeStampBase & ecl::TimeStampBase::stamp ( const time_t &  seconds,
const long &  nanoseconds 
)

Manually sets the timestamp with the specified values.

This is the fastest way of setting the timestamp.

Parameters:
seconds: discrete time value measured in whole seconds.
nanoseconds: fraction of a second measured in nanoseconds.
Exceptions:
StandardException: throws if input arguments are not positive [debug mode only].

Definition at line 51 of file timestamp_base.cpp.

long ecl::TimeStampBase::usec ( ) const [inline]

Microseconds component (after removing seconds).

Get the fractional number of microseconds recorded in this timestamp.

Returns:
long : the fractional amount of time recorded by this timestamp (in us).

Definition at line 118 of file timestamp_base.hpp.


Friends And Related Function Documentation

template<typename OutputStream >
OutputStream& operator<< ( OutputStream &  ostream,
const TimeStampBase time_stamp 
) [friend]

Definition at line 225 of file timestamp_base.hpp.


Member Data Documentation

TimeStructure ecl::TimeStampBase::time [protected]

Definition at line 216 of file timestamp_base.hpp.


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


ecl_time
Author(s): Daniel Stonier
autogenerated on Sun Oct 5 2014 23:35:32