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.