Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::G::TimeVal Class Reference

A GTimeVal C++ wrapper interface. More...

#include <xfc/glib/timeval.hh>

List of all members.

Public Member Functions

Constructors



Accessors



Methods




Detailed Description

A GTimeVal C++ wrapper interface.

TimeVal represents a time expressed in seconds and microseconds. TimeVal uses default copy, assignment and destruction.


Constructor & Destructor Documentation

Xfc::G::TimeVal::TimeVal ( long  seconds,
long  microseconds 
)

Construct a time value using the specified seconds and microseconds.

Parameters:
seconds The number of seconds.
microseconds The number of microseconds.

Both seconds and microseconds can be positive or negative. If microseconds is greater than G_USEC_PER_SEC this method will calculate the number of seconds in microseconds and adjust seconds.

Xfc::G::TimeVal::TimeVal ( const double &  timeval  ) 

Construct a time value from a double representation.

Parameters:
timeval The double time value.

In timeval the whole digits represents seconds and the fractional part represents microseconds. As an example, such a double value is returned by G::Timer::elapsed().

Xfc::G::TimeVal::TimeVal ( const GTimeVal &  timeval  ) 

Construct a time value from a existing GTimeVal.

Parameters:
timeval A reference to a GTimeVal.

Member Function Documentation

void Xfc::G::TimeVal::add ( const TimeVal other  ) 

Adds other to this time value.

Parameters:
other Another TimeVal object.
void Xfc::G::TimeVal::add ( long  seconds,
long  microseconds 
)

Adds the specified number of seconds and microseconds to the time value.

Parameters:
seconds The number of seconds to add.
microseconds The number of microseconds to add.

Both seconds and microseconds can be positive or negative. If microseconds is greater than G_USEC_PER_SEC this method will calculate the number of seconds in microseconds and adjust seconds.

void Xfc::G::TimeVal::add ( long  microseconds  ) 

Adds the specified number of microseconds to the time value.

Parameters:
microseconds The number of microseconds to add, either positive or negative.
long Xfc::G::TimeVal::difference ( const TimeVal other  ) 

Gets the time difference between this time value and other.

Parameters:
other Another TimeVal object.
Returns:
The time difference in microseconds.
bool Xfc::G::TimeVal::equal ( const TimeVal other  )  const

Tests this time value and other for equality.

Parameters:
other Another TimeVal object.
Returns:
true if this time value is equal to other.
double Xfc::G::TimeVal::get_double (  )  const

Converts the time value into a double floating-point value.

Returns:
The time as a double floating-point.

In the return value the whole digits represent the seconds and the the fractional part represents the microseconds.

bool Xfc::G::TimeVal::operator!= ( const TimeVal other  ) 

Inequality operator.

Parameters:
other Another TimeVal object.
Returns:
true if this time value is not equal to other.
TimeVal& Xfc::G::TimeVal::operator+= ( const TimeVal other  ) 

Adds other to the time value.

Parameters:
other Another TimeVal object.
Returns:
A reference to the time value.
TimeVal& Xfc::G::TimeVal::operator+= ( long  microseconds  ) 

Adds microseconds to the time value.

Parameters:
microseconds The number of microseconds to add.
Returns:
A reference to the time value.
TimeVal& Xfc::G::TimeVal::operator-= ( const TimeVal other  ) 

Subtract other from the time value.

Parameters:
other Another TimeVal object.
Returns:
A reference to the time value.
TimeVal& Xfc::G::TimeVal::operator-= ( long  microseconds  ) 

Subtracts microseconds from the time value.

Parameters:
microseconds The number of microseconds to subtract.
Returns:
A reference to the time value.
bool Xfc::G::TimeVal::operator< ( const TimeVal other  ) 

Less-than operator.

Parameters:
other Another TimeVal object.
Returns:
true if this time value is less than other.
bool Xfc::G::TimeVal::operator<= ( const TimeVal other  ) 

Less-than-or-equal-to operator.

Parameters:
other Another TimeVal object.
Returns:
true if this time value is less than or equal to other.
bool Xfc::G::TimeVal::operator== ( const TimeVal other  ) 

Equality operator.

Parameters:
other Another TimeVal object.
Returns:
true if this time value is equal to other.
bool Xfc::G::TimeVal::operator> ( const TimeVal other  ) 

Greater-than operator.

Parameters:
other Another TimeVal object.
Returns:
true if this time value is greater than other.
bool Xfc::G::TimeVal::operator>= ( const TimeVal other  ) 

Greater-than-or-equal-to operator.

Parameters:
other Another TimeVal object.
Returns:
true if this time value is greater than or equal to other.
void Xfc::G::TimeVal::subtract ( const TimeVal other  ) 

Subtracts other from this time value.

Parameters:
other Another TimeVal object.

The documentation for this class was generated from the following file:
Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3