---
name: "shevek_relative_time"
section: "3"
platform: "linux"
package: "libshevek-doc"
version: "1.4-1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/shevek_relative_time"
---

# shevek\_relative\_time(3)

Time interval.

## NAME

shevek::relative\_time -

Time interval.

## SYNOPSIS

`#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.*  **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 (timetypeseconds, unsignednanoseconds)

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\_timethat) 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\_timethat) const

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

## Author

Generated automatically by Doxygen for libshevek from the source code.
