glibmm  2.62.0
About: glibmm is a set of C++ bindings for glib, including cross-platform APIs such as a std::string-like UTF8 string class, string utility methods, such as a text encoding converter API, file access, and threads.
  Fossies Dox: glibmm-2.62.0.tar.xz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

Glib::TimeVal Struct Reference

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

#include <timeval.h>

Inheritance diagram for Glib::TimeVal:
[legend]
Collaboration diagram for Glib::TimeVal:
[legend]

Public Member Functions

 TimeVal ()
 
 TimeVal (long seconds, long microseconds)
 
 TimeVal (const GTimeVal &gtimeval)
 
TimeValoperator= (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)
 
TimeValoperator+= (const TimeVal &gtimeval)
 
TimeValoperator-= (const TimeVal &gtimeval)
 
TimeValoperator+= (long seconds)
 
TimeValoperator-= (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.

Definition at line 41 of file timeval.h.

Constructor & Destructor Documentation

◆ TimeVal() [1/3]

Glib::TimeVal::TimeVal ( )
inline

Definition at line 102 of file timeval.h.

◆ TimeVal() [2/3]

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

Definition at line 108 of file timeval.h.

◆ TimeVal() [3/3]

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

Definition at line 114 of file timeval.h.

Member Function Documentation

◆ add()

G_GNUC_END_IGNORE_DEPRECATIONS void Glib::TimeVal::add ( const TimeVal rhs)

Definition at line 39 of file timeval.cc.

Referenced by operator+=().

◆ add_microseconds()

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

Definition at line 117 of file timeval.cc.

◆ add_milliseconds()

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

◆ add_seconds()

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

Definition at line 73 of file timeval.cc.

Referenced by operator+=().

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

Definition at line 162 of file timeval.h.

◆ as_iso8601()

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

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

Since @PACKAGE_NAME@ 2.22:

Definition at line 129 of file timeval.cc.

◆ assign_current_time()

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

Definition at line 26 of file timeval.cc.

◆ 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_dateISO 8601 encoded string.
Returns
true if conversion was successful.
Since @PACKAGE_NAME@ 2.22:

Definition at line 32 of file timeval.cc.

References Glib::ustring::c_str().

◆ negative()

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

Definition at line 168 of file timeval.h.

Referenced by Glib::TimeoutSource::prepare().

◆ operator+=() [1/2]

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

Definition at line 130 of file timeval.h.

References add().

◆ operator+=() [2/2]

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

Definition at line 146 of file timeval.h.

References add_seconds().

◆ operator-=() [1/2]

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

Definition at line 138 of file timeval.h.

References subtract().

◆ operator-=() [2/2]

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

Definition at line 154 of file timeval.h.

References subtract_seconds().

◆ operator=()

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

Definition at line 121 of file timeval.h.

◆ subtract()

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

Definition at line 56 of file timeval.cc.

Referenced by operator-=(), and Glib::TimeoutSource::prepare().

◆ subtract_microseconds()

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

Definition at line 123 of file timeval.cc.

◆ subtract_milliseconds()

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

Definition at line 110 of file timeval.cc.

References add_milliseconds().

◆ subtract_seconds()

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

Definition at line 81 of file timeval.cc.

Referenced by operator-=().

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

Definition at line 174 of file timeval.h.

Friends And Related Function Documentation

◆ operator!=()

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

Definition at line 216 of file timeval.h.

◆ operator+() [1/2]

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

Definition at line 181 of file timeval.h.

◆ operator+() [2/2]

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

Definition at line 188 of file timeval.h.

◆ operator-() [1/2]

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

Definition at line 195 of file timeval.h.

◆ operator-() [2/2]

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

Definition at line 202 of file timeval.h.

◆ operator<()

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

Definition at line 223 of file timeval.h.

◆ operator<=()

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

Definition at line 237 of file timeval.h.

◆ operator==()

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

Definition at line 209 of file timeval.h.

◆ operator>()

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

Definition at line 230 of file timeval.h.

◆ operator>=()

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

Definition at line 244 of file timeval.h.


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