Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

Timespan Class Reference

Represents time spans up to microsecond resolution.

#include <cxxtools/timespan.h>

List of all members.

Public Member Functions

 Timespan ()
 Creates a zero Timespan.
 Timespan (int64_t microseconds)
 Creates a Timespan.
 Timespan (long seconds, long microseconds)
 Creates a Timespan. Useful for creating a Timespan from a struct timeval.
 Timespan (int days, int hours, int minutes, int seconds, int microseconds)
 Creates a Timespan.
 Timespan (const Timespan &timespan)
 Creates a Timespan from another one.
 ~Timespan ()
 Destroys the Timespan.
Timespanoperator= (const Timespan &timespan)
 Assignment operator.
Timespanoperator= (int64_t microseconds)
 Assignment operator.
Timespanset (int days, int hours, int minutes, int seconds, int microseconds)
 Assigns a new span.
Timespanset (long seconds, long microseconds)
 Assigns a new span. Useful for assigning from a struct timeval.
void swap (Timespan &timespan)
 Swaps the Timespan with another one.
bool operator== (const Timespan &ts) const
bool operator!= (const Timespan &ts) const
bool operator> (const Timespan &ts) const
bool operator>= (const Timespan &ts) const
bool operator< (const Timespan &ts) const
bool operator<= (const Timespan &ts) const
bool operator== (int64_t microseconds) const
bool operator!= (int64_t microseconds) const
bool operator> (int64_t microseconds) const
bool operator>= (int64_t microseconds) const
bool operator< (int64_t microseconds) const
bool operator<= (int64_t microseconds) const
Timespan operator+ (const Timespan &d) const
Timespan operator- (const Timespan &d) const
Timespanoperator+= (const Timespan &d)
Timespanoperator-= (const Timespan &d)
Timespan operator+ (int64_t microseconds) const
Timespan operator- (int64_t microseconds) const
Timespanoperator+= (int64_t microseconds)
Timespanoperator-= (int64_t microseconds)
int days () const
 Returns the number of days.
int hours () const
 Returns the number of hours (0 to 23).
int totalHours () const
 Returns the total number of hours.
int minutes () const
 Returns the number of minutes (0 to 59).
int totalMinutes () const
 Returns the total number of minutes.
int seconds () const
 Returns the number of seconds (0 to 59).
int totalSeconds () const
 Returns the total number of seconds.
int msecs () const
 Returns the number of milliseconds (0 to 999).
int64_t totalMSecs () const
 Returns the total number of milliseconds.
int microseconds () const
 Returns the fractions of a millisecond in microseconds (0 to 999).
int useconds () const
 Returns the fractions of a second in microseconds (0 to 999).
int64_t toUSecs () const
 Returns the total number of microseconds.

Static Public Member Functions

static Timespan gettimeofday ()
 returns the current time as a timespan value.

Static Public Attributes

static const int64_t Milliseconds = 1000
 The number of microseconds in a millisecond.
static const int64_t Seconds = 1000 * Timespan::Milliseconds
static const int64_t Minutes = 60 * Timespan::Seconds
static const int64_t Hours = 60 * Timespan::Minutes
static const int64_t Days = 24 * Timespan::Hours


Member Data Documentation

const int64_t Milliseconds = 1000 [static]

The number of microseconds in a second. The number of microseconds in a minute. The number of microseconds in a hour. The number of microseconds in a day.

Referenced by Timespan::msecs(), and Timespan::totalMSecs().

Copyright © 2008 The Tntnet Development Team
Tntnet 1.6