glibmm: Glib::TimeVal Struct Reference

glibmm 2.66.5

Public Member Functions | Related Functions | List of all members
Glib::TimeVal Struct Reference

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

`#include <glibmm/timeval.h>`

Inherits GTimeVal.

## 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. More...
bool | assign_from_iso8601 (const Glib::ustring & iso_date)
| Converts a string containing an ISO 8601 encoded date and time to a Glib::TimeVal and puts it in TimeVal instance. More...
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. More...
Glib::ustring | as_iso8601 () const
| Returns an ISO 8601 encoded string, relative to the Coordinated Universal Time (UTC). More...
bool | negative () const
bool | valid () const
| Checks whether the stored time interval is positive. More...

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

Deprecated:
  Use Glib::DateTime instead.

## Constructor & Destructor Documentation

## ◆ TimeVal() [1/3]

Glib::TimeVal::TimeVal | ( |  | ) |
| inline

## ◆ TimeVal() [2/3]

Glib::TimeVal::TimeVal | ( | long | seconds,
|  | long | microseconds
| ) |  |
| inline

## ◆ TimeVal() [3/3]

Glib::TimeVal::TimeVal | ( | const GTimeVal & | gtimeval | ) |
| inline

## Member Function Documentation

## ◆ add()

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

## ◆ add_microseconds()

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

## ◆ add_milliseconds()

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

## ◆ add_seconds()

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

## ◆ as_double()

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.

## ◆ as_iso8601()

Glib::ustring Glib::TimeVal::as_iso8601 | ( |  | ) | const

Returns an ISO 8601 encoded string, relative to the Coordinated Universal Time (UTC).

Since glibmm 2.22:

## ◆ assign_current_time()

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.

## ◆ assign_from_iso8601()

bool Glib::TimeVal::assign_from_iso8601 | ( | const Glib::ustring & | iso_date | ) |

Converts a string containing an ISO 8601 encoded date and time to a Glib::TimeVal and puts it in TimeVal instance.

Parameters

  iso_date | ISO 8601 encoded string.

Returns
  `true` if conversion was successful.

Since glibmm 2.22:

## ◆ negative()

bool Glib::TimeVal::negative | ( |  | ) | const
| inline

## ◆ operator+=() [1/2]

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

## ◆ operator+=() [2/2]

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

## ◆ operator-=() [1/2]

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

## ◆ operator-=() [2/2]

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

## ◆ operator=()

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

## ◆ subtract()

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

## ◆ subtract_microseconds()

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

## ◆ subtract_milliseconds()

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

## ◆ subtract_seconds()

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

## ◆ valid()

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

## ◆ operator!=()

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

## ◆ operator+() [1/2]

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

## ◆ operator+() [2/2]

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

## ◆ operator-() [1/2]

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

## ◆ operator-() [2/2]

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

## ◆ operator<()

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

## ◆ operator<=()

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

## ◆ operator==()

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

## ◆ operator>()

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

## ◆ operator>=()

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