Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# timeval.hh File Reference

GTimeVal C++ interface. More...

`#include <xfc/object.hh>`
`#include <glib/gtypes.h>`
`#include <xfc/glib/inline/timeval.inl>`

## Namespaces

- namespace Xfc
- namespace Xfc::G

## Classes

- class Xfc::G::TimeVal
    A GTimeVal C++ wrapper interface. More...

## Time Methods

- TimeVal get_current_time ()
    Equivalent to the UNIX gettimeofday() function, but portable.
- void usleep (unsigned long microseconds)
    Pauses execution of the current thread for the given number of microseconds.

## TimeVal addition operators

- const TimeVal operator+ (const TimeVal &lhs, long microseconds)
    Add a specified number of microseconds to the TimeVal object lhs.
- const TimeVal operator+ (const TimeVal &lhs, const TimeVal &rhs)
    Add two TimeVal objects together.

## TimeVal subtraction operators

- const TimeVal operator- (const TimeVal &lhs, long microseconds)
    Subtract a specified number of microseconds from the TimeVal object lhs.
- const TimeVal operator- (const TimeVal &lhs, const TimeVal &rhs)
    Subtract the TimeVal object rhs from lhs.

## Detailed Description

GTimeVal C++ interface.

Provides TimeVal, an object that represents a precise time, with seconds and microseconds. Same as the struct timeval returned by the gettimeofday() UNIX call.

## Function Documentation

TimeVal get_current_time | ( |  | ) |

Equivalent to the UNIX gettimeofday() function, but portable.

Returns:
  A TimeVal object that stores the current time.

void usleep | ( | unsigned long | microseconds | ) |

Pauses execution of the current thread for the given number of microseconds.

Parameters:

  | microseconds | The number of microseconds to pause.

There are 1 million microseconds per second (represented by the G_USEC_PER_SEC macro). This method may have limited precision, depending on hardware and operating system; don't rely on the exact length of the sleep.

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3