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

# shevek\_absolute\_time(3)

The absolute\_time class stores a date and time.

## NAME

shevek::absolute\_time -  The **absolute\_time** class stores a date and time.

## SYNOPSIS

`#include <time.hh>`

### Public Member Functions

**absolute\_time** ()\
 *Create a new* **absolute\_time** *containing the current time.*  **absolute\_time** (unsigned years, unsigned months, unsigned **days**, unsigned hours, unsigned minutes, unsigned seconds, unsigned **nanoseconds**=0)\
 *A specific time.*  **absolute\_time** (timetype seconds, unsigned **nanoseconds**)\
 *Fast constructor.*  **absolute\_time** **operator+** (**relative\_time** that) const \
 *Add an interval to this moment.*  **absolute\_time** **operator-** (**relative\_time** that) const \
 *Subtract an interval from this moment.*  **relative\_time** **operator-** (**absolute\_time** that) const \
 *Compute the interval between two moments.*  **absolute\_time** & **operator+=** (**relative\_time** that)\
 *Add an interval to this moment.*  **absolute\_time** & **operator-=** (**relative\_time** that)\
 *Subtract an interval from this moment.*  bool **operator\<** (**absolute\_time** that) const \
 *Compare two moments.*  bool **operator\>** (**absolute\_time** that) const \
 *Compare two moments.*  bool **operator\<=** (**absolute\_time** that) const \
 *Compare two moments.*  bool **operator\>=** (**absolute\_time** that) const \
 *Compare two moments.*  bool **operator==** (**absolute\_time** that) const \
 *Compare two moments.*  bool **operator!=** (**absolute\_time** that) const \
 *Compare two moments.*  unsigned **nanoseconds** () const \
 *Get the nanoseconds.*  unsigned **local\_second** () const \
 *Get the seconds in local time.*  unsigned **local\_minute** () const \
 *Get the minutes in local time.*  unsigned **local\_hour** () const \
 *Get the hour in local time.*  unsigned **local\_days** () const \
 *Get the day of the year in local time, range 0-365.*  unsigned **local\_day** () const \
 *Get the day of the month in local time, range 1-31.*  unsigned **local\_weekday** () const \
 *Get the day of the week in local time, range 0-6 where 0 means sunday.*  unsigned **local\_month** () const \
 *Get the month in local time, range 1-12.*  unsigned **local\_year** () const \
 *Get the year in local time.*  unsigned **second** () const \
 *Get the seconds in UTC.*  unsigned **minute** () const \
 *Get the minutes in UTC.*  unsigned **hour** () const \
 *Get the hour in UTC.*  unsigned **days** () const \
 *Get the day of the year in UTC, range 0-365.*  unsigned **day** () const \
 *Get the day of the month in UTC, range 1-31.*  unsigned **weekday** () const \
 *Get the day of the week in UTC, range 0-6 where 0 means sunday.*  unsigned **month** () const \
 *Get the month in UTC, range 1-12.*  unsigned **year** () const \
 *Get the year in UTC.*  timetype **total** () const \
 *Total number of seconds since january 1970, as encoded.*  sigc::connection **schedule** (sigc::slot0\< void \> callback, Glib::RefPtr\< Glib::MainContext \> context=Glib::MainContext::get\_default())\
 *Schedule a callback at a certain time.*

### Static Public Member Functions

static **absolute\_time** **create\_from\_local** (unsigned years, unsigned months, unsigned **days**, unsigned hours, unsigned minutes, unsigned seconds, unsigned **nanoseconds**=0)\
 *Semi-constructor which creates a new* **absolute\_time** *given a date in local time.*  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 which is used when printing.*

### Friends

sigc::connection **schedule** (sigc::slot0\< void \> callback, int prio, Glib::RefPtr\< Glib::MainContext \> context)\
 *Schedule a callback for when the main loop has time.*  std::ostream & **operator\<\<** (std::ostream &s, **absolute\_time** t)\
 *Write the time to a std::ostream.*

## Detailed Description

The **absolute\_time** class stores a date and time.

Everything is in UTC, except the output of local\_\* ();

## Constructor & Destructor Documentation

### shevek::absolute\_time::absolute\_time ()

Create a new **absolute\_time** containing the current time. Note that this makes a call to gettimeofday, which is much slower than specifying seconds and nanoseconds. Thus, if you need an **absolute\_time** object to fill with an actual time later, use **absolute\_time** foo (0, 0); instead of this default constructor.

### shevek::absolute\_time::absolute\_time (unsignedyears, unsignedmonths, unsigneddays, unsignedhours, unsignedminutes, unsignedseconds, unsignednanoseconds = `0`)

A specific time. days may be 0-365, with months 0. If months \> 0, both days and months have a base of 1.

### shevek::absolute\_time::absolute\_time (timetypeseconds, unsignednanoseconds)

Fast constructor. This directly fills the internal structures. It is therefore faster than the other constructors, in particular the default constructor, which makes a kernel call.

## Member Function Documentation

### static absolute\_time shevek::absolute\_time::create\_from\_local (unsignedyears, unsignedmonths, unsigneddays, unsignedhours, unsignedminutes, unsignedseconds, unsignednanoseconds = `0`)` [static]`

Semi-constructor which creates a new **absolute\_time** given a date in local time. The input is the same as for the similar constructor.

### bool shevek::absolute\_time::operator!= (absolute\_timethat) const

Compare two moments. Note that this is rarely a useful operation, because minor errors may be introduced by computations. In other words: only use this on times which have been set, never on times which have been computed.

### bool shevek::absolute\_time::operator== (absolute\_timethat) const

Compare two moments. Note that this is rarely a useful operation, because minor errors may be introduced by computations. In other words: only use this on times which have been set, never on times which have been computed.

## Author

Generated automatically by Doxygen for libshevek from the source code.
