Main Page Widgets glibmm Namespaces Book

# Glib::TimeVal Struct Reference

Glib::TimeVal is a wrapper around the glib structure GTimeVal. More...

Inheritance diagram for Glib::TimeVal:

[legend]
List of all members.

## Public Member Functions

| TimeVal ()
| TimeVal (long seconds, long microseconds)
| TimeVal (const GTimeVal& gtimeval)
TimeVal& | operator= (const GTimeVal& gtimeval)
void | assign_current_time ()
| Assigns the current time to the TimeVal instance.
void | add (const TimeVal& rhs)
void | subtract (const TimeVal& rhs)
void | add_seconds (long seconds)
void | subtract_seconds (long seconds)
void | add_milliseconds (long milliseconds)
void | subtract_milliseconds (long milliseconds)
void | add_microseconds (long microseconds)
void | subtract_microseconds (long microseconds)
TimeVal& | operator+= (const TimeVal& gtimeval)
TimeVal& | operator-= (const TimeVal& gtimeval)
TimeVal& | operator+= (long seconds)
TimeVal& | operator-= (long seconds)
double | as_double () const
| Returns a double representation of the time interval.
bool | negative () const
bool | valid () const
| Checks whether the stored time interval is positive.

## Related Functions

(Note that these are not member functions.)
TimeVal | operator+ (const TimeVal& lhs, const TimeVal& rhs)
TimeVal | operator+ (const TimeVal& lhs, long seconds)
TimeVal | operator- (const TimeVal& lhs, const TimeVal& rhs)
TimeVal | operator- (const TimeVal& lhs, long seconds)
bool | operator== (const TimeVal& lhs, const TimeVal& rhs)
bool | operator!= (const TimeVal& lhs, const TimeVal& rhs)
bool | operator< (const TimeVal& lhs, const TimeVal& rhs)
bool | operator> (const TimeVal& lhs, const TimeVal& rhs)
bool | operator<= (const TimeVal& lhs, const TimeVal& rhs)
bool | operator>= (const TimeVal& lhs, const TimeVal& rhs)

## Detailed Description

Glib::TimeVal is a wrapper around the glib structure GTimeVal.

The glib structure GTimeVal itself is equivalent to struct timeval, which is returned by the gettimeofday() UNIX call. Additionally this wrapper provides an assortment of time manipulation functions.

## Constructor & Destructor Documentation

Glib::TimeVal::TimeVal | ( |  | ) | `[inline]`

Glib::TimeVal::TimeVal | ( | long | seconds,
|  | long | microseconds |
| ) |  |  | `[inline]`

Glib::TimeVal::TimeVal | ( | const GTimeVal& | gtimeval | ) | `[inline]`

## Member Function Documentation

TimeVal& Glib::TimeVal::operator= | ( | const GTimeVal& | gtimeval | ) | `[inline]`

void Glib::TimeVal::assign_current_time | ( |  | ) |

Assigns the current time to the TimeVal instance.

Equivalent to the UNIX gettimeofday() function, but is portable and works also on Win32.

void Glib::TimeVal::add | ( | const TimeVal& | rhs | ) |

void Glib::TimeVal::subtract | ( | const TimeVal& | rhs | ) |

void Glib::TimeVal::add_seconds | ( | long | seconds | ) |

void Glib::TimeVal::subtract_seconds | ( | long | seconds | ) |

void Glib::TimeVal::add_milliseconds | ( | long | milliseconds | ) |

void Glib::TimeVal::subtract_milliseconds | ( | long | milliseconds | ) |

void Glib::TimeVal::add_microseconds | ( | long | microseconds | ) |

void Glib::TimeVal::subtract_microseconds | ( | long | microseconds | ) |

TimeVal& Glib::TimeVal::operator+= | ( | const TimeVal& | gtimeval | ) | `[inline]`

TimeVal& Glib::TimeVal::operator-= | ( | const TimeVal& | gtimeval | ) | `[inline]`

TimeVal& Glib::TimeVal::operator+= | ( | long | seconds | ) | `[inline]`

TimeVal& Glib::TimeVal::operator-= | ( | long | seconds | ) | `[inline]`

double Glib::TimeVal::as_double | ( |  | ) | const`[inline]`

Returns a double representation of the time interval.

This member function converts the time interval, that is internally stored as two long values for seconds and microseconds, to a double representation, whose unit is seconds.

bool Glib::TimeVal::negative | ( |  | ) | const`[inline]`

bool Glib::TimeVal::valid | ( |  | ) | const`[inline]`

Checks whether the stored time interval is positive.

Returns true if the stored time / time interval is positive.

## Friends And Related Function Documentation

TimeVal operator+ | ( | const TimeVal& | lhs,
|  | const TimeVal& | rhs |
| ) |  |  | `[related]`

TimeVal operator+ | ( | const TimeVal& | lhs,
|  | long | seconds |
| ) |  |  | `[related]`

TimeVal operator- | ( | const TimeVal& | lhs,
|  | const TimeVal& | rhs |
| ) |  |  | `[related]`

TimeVal operator- | ( | const TimeVal& | lhs,
|  | long | seconds |
| ) |  |  | `[related]`

bool operator== | ( | const TimeVal& | lhs,
|  | const TimeVal& | rhs |
| ) |  |  | `[related]`

bool operator!= | ( | const TimeVal& | lhs,
|  | const TimeVal& | rhs |
| ) |  |  | `[related]`

bool operator< | ( | const TimeVal& | lhs,
|  | const TimeVal& | rhs |
| ) |  |  | `[related]`

bool operator> | ( | const TimeVal& | lhs,
|  | const TimeVal& | rhs |
| ) |  |  | `[related]`

bool operator<= | ( | const TimeVal& | lhs,
|  | const TimeVal& | rhs |
| ) |  |  | `[related]`

bool operator>= | ( | const TimeVal& | lhs,
|  | const TimeVal& | rhs |
| ) |  |  | `[related]`

The documentation for this struct was generated from the following file:

- timeval.h