NAME
ACE_Time_Value -
Operations on "timeval" structures.
SYNOPSIS
#include <ace/Time_Value.h>
class ACE_Time_Value
{
public:
static const ACE_Time_Value zero;
ACE_Time_Value (long sec = 0, long usec = 0);
ACE_Time_Value (const timeval &t);
ACE_Time_Value (const timestruc_t &t);
ACE_Time_Value (const ACE_Time_Value &tv);
ACE_Time_Value (const FILETIME &ft);
void set (long sec = 0, long usec = 0);
void set (const timeval &t);
void set (const timestruc_t &t);
void set (const FILETIME &ft);
long msec (void) const;
void msec (long);
operator timestruc_t () const;
operator timeval () const;
operator FILETIME () const;
long sec (void) const;
void sec (long sec);
long usec (void) const;
void usec (long usec);
void operator += (const ACE_Time_Value &tv);
void operator -= (const ACE_Time_Value &tv);
friend ACE_Export ACE_Time_Value operator + (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
friend ACE_Export ACE_Time_Value operator - (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
friend ACE_Export int operator < (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
friend ACE_Export int operator > (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
friend ACE_Export int operator <= (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
friend ACE_Export int operator >= (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
friend ACE_Export int operator == (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
friend ACE_Export int operator != (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
void dump (void) const;
private:
void normalize (void);
long tv_sec_;
long tv_usec_;
};
DESCRIPTION
This class centralizes all the time-related processing in
ACE. These timers are typically used in conjunction with
lower-level OS mechanisms like select(), poll(), or
cond_timedwait(). ACE_Time_Value help make the use of these
mechanisms portable across OS platforms,
Useful constants.
static const ACE_Time_Value zero;
Initialization method.
ACE_Time_Value (long sec = 0, long usec = 0);
Methods for converting to/from various time formats.
ACE_Time_Value (const timeval &t);
Construct a Time_Value from a timeval.
ACE_Time_Value (const timestruc_t &t);
Initializes the ACE_Time_Value object from a timestruc_t.
ACE_Time_Value (const ACE_Time_Value &tv);
ACE_Time_Value (const FILETIME &ft);
Initializes the ACE_Time_Value object from a Win32 FILETIME
void set (long sec = 0, long usec = 0);
Construct a Time_Value from a timeval.
void set (const timeval &t);
Construct a Time_Value from a timeval.
void set (const timestruc_t &t);
Initializes the ACE_Time_Value object from a timestruc_t.
void set (const FILETIME &ft);
Initializes the ACE_Time_Value object from a timestruc_t.
long msec (void) const;
Converts from Time_Value format into milli-seconds format.
void msec (long);
Converts from milli-seconds format into Time_Value format.
operator timestruc_t () const;
Returns the value of the object as a timestruc_t.
operator timeval () const;
Returns the value of the object as a timeval.
operator FILETIME () const;
Returns the value of the object as a Win32 FILETIME.
The following are accessor/mutator methods.
long sec (void) const;
void sec (long sec);
long usec (void) const;
void usec (long usec);
The following are arithmetic methods for operating on
Time_Values.
void operator += (const ACE_Time_Value &tv);
void operator -= (const ACE_Time_Value &tv);
friend ACE_Export ACE_Time_Value operator + (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
Adds two ACE_Time_Value objects together, returns the sum.
friend ACE_Export ACE_Time_Value operator - (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
Subtracts two ACE_Time_Value objects, returns the difference.
friend ACE_Export int operator < (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
friend ACE_Export int operator > (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
friend ACE_Export int operator <= (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
friend ACE_Export int operator >= (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
friend ACE_Export int operator == (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
friend ACE_Export int operator != (
const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2
);
void dump (void) const;
Dump the state of an object.
AUTHOR
Doug Schmidt
LIBRARY
ace