shevek::relative_time Class Reference

Time interval. More...

`#include <time.hh>`

## Public Member Functions

| relative_time ()
| The default constructor creates an interval of 0.
| relative_time (timetype days, int hours, int minutes, int seconds, int nanoseconds=0)
| Construct an interval of a given size.
| relative_time (timetype seconds, unsigned nanoseconds)
| Fast constructor. More...
relative_time | operator+ (relative_time that) const
| Add two intervals.
absolute_time | operator+ (absolute_time that) const
| Add an interval to a moment.
relative_time | operator- (relative_time that) const
| Subtract two intervals.
relative_time | operator- () const
| Negate an interval.
relative_time | operator* (float c) const
| Scale an interval.
relative_time | operator/ (float c) const
| Scale an interval.
relative_time | operator% (relative_time that) const
| Modulo operator for two intervals.
double | operator/ (relative_time that) const
| Division of two intervals.
relative_time & | operator+= (relative_time that)
| Add an interval.
relative_time & | operator-= (relative_time that)
| Subtract an interval.
relative_time & | operator*= (float c)
| Scale the interval.
relative_time & | operator/= (float c)
| Scale the interval.
relative_time & | operator%= (relative_time that)
| Modulo.
bool | operator< (relative_time that) const
| Compare with another interval.
bool | operator> (relative_time that) const
| Compare with another interval.
bool | operator<= (relative_time that) const
| Compare with another interval.
bool | operator>= (relative_time that) const
| Compare with another interval.
bool | operator== (relative_time that) const
bool | operator!= (relative_time that) const
unsigned | nanoseconds () const
| Number of nanoseconds.
unsigned | seconds () const
| Number of seconds.
unsigned | minutes () const
| Number of minutes.
unsigned | hours () const
| Number of hours.
unsigned | days () const
| Number of days.
bool | isnegative () const
| Is this a negative interval?
timetype | total () const
| Total number of seconds, as encoded.

## Static Public Member Functions

static void | set_digits (unsigned num)
| Set number of digits to use when printing (for fractions of seconds).
static unsigned | get_digits ()
| Get the number of digits that is used when printing.

## Friends

std::ostream & | operator<< (std::ostream &s, relative_time t)
| Write the interval to a std::ostream.

## Detailed Description

Time interval.

## Constructor & Destructor Documentation

shevek::relative_time::relative_time | ( | timetype | seconds,
|  | unsigned | nanoseconds
| ) |  |

Fast constructor.

This directly fills the members and is therefore slightly faster than the other constructors. However, the others aren't really slow either.

## Member Function Documentation

bool shevek::relative_time::operator!= | ( | relative_time | that | ) | const

Compare two intervals. Note that this is rarely a useful operation, because minor errors may be introduced by computations.

bool shevek::relative_time::operator== | ( | relative_time | that | ) | const

Compare two intervals. Note that this is rarely a useful operation, because minor errors may be introduced by computations.

The documentation for this class was generated from the following file:

- src/time.hh