Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::G::TimeVal Class Reference

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

`#include <inti/glib/timeval.h>`

List of all members.

## Public Member Functions

Constructors

- TimeVal ()
    Construct an empty time value.
- TimeVal (long seconds, long microseconds)
    Construct a time value using the specified seconds and microseconds.
- TimeVal (const double &timeval)
    Construct a time value from a double representation.
- TimeVal (const GTimeVal &timeval)
    Construct a time value from a existing GTimeVal.

Accessors

- GTimeVal * g_time_val () const
    Get a pointer to the GTimeVal structure.
- operator GTimeVal * () const
    Conversion operator; Safely converts a G::TimeVal object into a GTimeVal pointer.
- long seconds () const
    Returns the number of seconds in the time value.
- long microseconds () const
    Returns the number of microseconds in the time value.
- double get_double () const
    Converts the time value into a double floating-point value.
- bool equal (const TimeVal &other) const
    Tests this time value and other for equality.
- bool operator== (const TimeVal &other)
    Equality operator.
- bool operator!= (const TimeVal &other)
    Inequality operator.
- bool operator< (const TimeVal &other)
    Less-than operator.
- bool operator<= (const TimeVal &other)
    Less-than-or-equal-to operator.
- bool operator> (const TimeVal &other)
    Greater-than operator.
- bool operator>= (const TimeVal &other)
    Greater-than-or-equal-to operator.

Methods

- void add (long microseconds)
    Adds the specified number of microseconds to the time value.
- void add (long seconds, long microseconds)
    Adds the specified number of seconds and microseconds to the time value.
- void add (const TimeVal &other)
    Adds other to this time value.
- void subtract (const TimeVal &other)
    Subtracts other from this time value.
- long difference (const TimeVal &other)
    Gets the time difference between this time value and other.
- TimeVal & operator+= (long microseconds)
    Adds microseconds to the time value.
- TimeVal & operator+= (const TimeVal &other)
    Adds other to the time value.
- TimeVal & operator-= (long microseconds)
    Subtracts microseconds from the time value.
- TimeVal & operator-= (const TimeVal &other)
    Subtract other from the time value.

## 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

Inti::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.

Inti::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().

Inti::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 Inti::G::TimeVal::add | ( | const TimeVal & | other | ) |

  | Adds other to this time value. Parameters:
  other | Another TimeVal object.

void Inti::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 Inti::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 Inti::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 Inti::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 Inti::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 Inti::G::TimeVal::operator!= | ( | const TimeVal & | other | ) | `[inline]`

  | Inequality operator. Parameters:
  other | Another TimeVal object.
Returns: true if this time value is not equal to other.

TimeVal& Inti::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& Inti::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& Inti::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& Inti::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 Inti::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 Inti::G::TimeVal::operator<= | ( | const TimeVal & | other | ) | `[inline]`

  | 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 Inti::G::TimeVal::operator== | ( | const TimeVal & | other | ) | `[inline]`

  | Equality operator. Parameters:
  other | Another TimeVal object.
Returns: true if this time value is equal to other.

bool Inti::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 Inti::G::TimeVal::operator>= | ( | const TimeVal & | other | ) | `[inline]`

  | 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 Inti::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:

- timeval.h

Main Page - Footer