Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

TimeValue Class Reference

Holds a value of time, usually used for measuring differences between two points in time. More...

#include <TimeValue.h>

Inheritance diagram for TimeValue::

BasicObject List of all members.

Public Methods

 TimeValue ()
 Initialize time to zero. More...

 TimeValue (const TimeValue &)
 TimeValue (int, int)
 Create a time value, initialized to the values passed in. More...

TimeValue operator- (const TimeValue &)
 Subtract the value from this TimeValue and return the result. More...

TimeValue operator+ (const TimeValue &)
 Add the value to this TimeValue and return the result. More...

TimeValue operator * (double value)
 Mutiplies time by a double, results the result. More...

virtual ~TimeValue ()
void setToCurrentTime ()
 Set this TimeValue to the current time, as returned by the particular system call for your OS. More...

timeval getTimevalStruct ()
 Return a timeval struct that is equivalent to the time stored in this object. More...

timespec getTimespecStruct ()
 Return a timespec struct that is equivalent to the value stored in this object. More...

bool isZero ()
 Return true if this value is zero. More...

long getSeconds ()
 Get the "seconds" portion of the time value. More...

long getMilliseconds ()
 Get the "milliseconds" portion of the time value. More...

long getTotalMilliseconds ()
 Get the time as a total number of milliseconds. More...

long getMicroseconds ()
 Get the "microseconds" portion of the time value. More...

void setSeconds (long)
 Set the "seconds" portion of the time value. More...

void setMilliseconds (long)
 Set the milliseconds portion of the time value. More...

void setMicroseconds (long)
virtual void toStream (std::ostream &)

Static Public Methods

TimeValue getCurrentTime ()
 Return the current time. More...


Private Methods

void doCarry ()

Private Attributes

timeval m_timeValue
timespec m_timeSpec

Friends

bool operator< (const TimeValue &value1, const TimeValue &value2)

Detailed Description

Holds a value of time, usually used for measuring differences between two points in time.

Definition at line 7 of file TimeValue.h.


Constructor & Destructor Documentation

TimeValue::TimeValue
 

Initialize time to zero.

Definition at line 12 of file TimeValue.cpp.

TimeValue::TimeValue const TimeValue & value
 

Definition at line 18 of file TimeValue.cpp.

TimeValue::TimeValue int seconds,
int microseconds
 

Create a time value, initialized to the values passed in.

Parameters:
seconds   The seconds value for the time.
microseconds   The microseconds for the time.

Definition at line 29 of file TimeValue.cpp.

virtual TimeValue::~TimeValue [inline, virtual]
 

Definition at line 17 of file TimeValue.h.


Member Function Documentation

void TimeValue::doCarry [private]
 

Definition at line 198 of file TimeValue.cpp.

Referenced by TimeValue(), operator *(), operator+(), setMicroseconds(), and setMilliseconds().

TimeValue TimeValue::getCurrentTime [static]
 

Return the current time.

Definition at line 113 of file TimeValue.cpp.

Referenced by Timer::addEvent(), NetworkLayer::handlePongPacket(), SendWindow::onAckRecvd(), TimerNode::past(), and Condition::timedWait().

long TimeValue::getMicroseconds
 

Get the "microseconds" portion of the time value.

Definition at line 183 of file TimeValue.cpp.

long TimeValue::getMilliseconds
 

Get the "milliseconds" portion of the time value.

Definition at line 164 of file TimeValue.cpp.

Referenced by getTotalMilliseconds().

long TimeValue::getSeconds
 

Get the "seconds" portion of the time value.

Definition at line 155 of file TimeValue.cpp.

Referenced by getTotalMilliseconds(), and SendWindow::onAckRecvd().

timespec TimeValue::getTimespecStruct
 

Return a timespec struct that is equivalent to the value stored in this object.

Definition at line 135 of file TimeValue.cpp.

Referenced by Condition::timedWait(), and Timer::timerThreadImpl().

timeval TimeValue::getTimevalStruct
 

Return a timeval struct that is equivalent to the time stored in this object.

Definition at line 125 of file TimeValue.cpp.

long TimeValue::getTotalMilliseconds
 

Get the time as a total number of milliseconds.

Returns:
(seconds * 1000 + milliseconds).

Definition at line 174 of file TimeValue.cpp.

Referenced by SendWindow::reliableSend().

bool TimeValue::isZero
 

Return true if this value is zero.

Definition at line 146 of file TimeValue.cpp.

Referenced by NetworkLayer::handlePongPacket().

TimeValue TimeValue::operator * double value
 

Mutiplies time by a double, results the result.

Definition at line 70 of file TimeValue.cpp.

TimeValue TimeValue::operator+ const TimeValue & value
 

Add the value to this TimeValue and return the result.

Definition at line 57 of file TimeValue.cpp.

TimeValue TimeValue::operator- const TimeValue & value
 

Subtract the value from this TimeValue and return the result.

This does not modify the current object.

Definition at line 41 of file TimeValue.cpp.

void TimeValue::setMicroseconds long value
 

Definition at line 215 of file TimeValue.cpp.

void TimeValue::setMilliseconds long value
 

Set the milliseconds portion of the time value.

Definition at line 208 of file TimeValue.cpp.

Referenced by SendWindow::SendWindow().

void TimeValue::setSeconds long value
 

Set the "seconds" portion of the time value.

Definition at line 192 of file TimeValue.cpp.

void TimeValue::setToCurrentTime
 

Set this TimeValue to the current time, as returned by the particular system call for your OS.

Definition at line 95 of file TimeValue.cpp.

Referenced by getCurrentTime(), NetworkLayer::ping(), and SendWindow::reliableSend().

void TimeValue::toStream std::ostream & out [virtual]
 

Reimplemented from BasicObject.

Definition at line 222 of file TimeValue.cpp.


Friends And Related Function Documentation

bool operator< const TimeValue & value1,
const TimeValue & value2
[friend]
 

Definition at line 229 of file TimeValue.cpp.


Member Data Documentation

timespec TimeValue::m_timeSpec [private]
 

Definition at line 41 of file TimeValue.h.

timeval TimeValue::m_timeValue [private]
 

Definition at line 40 of file TimeValue.h.


The documentation for this class was generated from the following files:
Generated at Thu Jul 11 13:31:59 2002 for Peekabooty by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001