18 #ifndef SHEVEK_TIME_HH 19 #define SHEVEK_TIME_HH 27 sigc::connection schedule (sigc::slot0 <void> callback,
int prio = Glib::PRIORITY_HIGH_IDLE, Glib::RefPtr <Glib::MainContext> context = Glib::MainContext::get_default () );
30 typedef int64_t timetype;
41 unsigned m_nanoseconds;
42 static bool l_schedule (sigc::slot0 <void> callback);
45 sigc::connection
schedule (sigc::slot0 <void> callback,
int prio,
46 Glib::RefPtr <Glib::MainContext> context);
47 static unsigned s_digits;
58 absolute_time (
unsigned years,
unsigned months,
unsigned days,
unsigned hours,
unsigned minutes,
unsigned seconds,
unsigned nanoseconds = 0);
67 static absolute_time create_from_local (
unsigned years,
unsigned months,
unsigned days,
unsigned hours,
unsigned minutes,
unsigned seconds,
unsigned nanoseconds = 0);
123 unsigned hour ()
const;
125 unsigned days ()
const;
127 unsigned day ()
const;
131 unsigned month ()
const;
133 unsigned year ()
const;
135 timetype
total ()
const;
137 sigc::connection
schedule (sigc::slot0 <void> callback, Glib::RefPtr <Glib::MainContext> context = Glib::MainContext::get_default ());
149 static unsigned s_digits;
207 unsigned seconds ()
const;
209 unsigned minutes ()
const;
211 unsigned hours ()
const;
213 unsigned days ()
const;
215 bool isnegative ()
const;
217 timetype
total ()
const;
225 std::istream &operator>> (std::istream &s,
absolute_time &t);
227 std::istream &operator>> (std::istream &s,
relative_time &t);
static unsigned get_digits()
Get the number of digits which is used when printing.
bool operator==(absolute_time that) const
Compare two moments.
unsigned local_weekday() const
Get the day of the week in local time, range 0-6 where 0 means sunday.
bool operator!=(absolute_time that) const
Compare two moments.
unsigned local_minute() const
Get the minutes in local time.
Time interval.
Definition: time.hh:143
absolute_time()
Create a new absolute_time containing the current time.
unsigned local_second() const
Get the seconds in local time.
absolute_time operator+(relative_time that) const
Add an interval to this moment.
bool operator>(absolute_time that) const
Compare two moments.
bool operator<=(absolute_time that) const
Compare two moments.
friend sigc::connection schedule(sigc::slot0< void > callback, int prio, Glib::RefPtr< Glib::MainContext > context)
Schedule a callback for when the main loop has time.
bool operator<(absolute_time that) const
Compare two moments.
unsigned hour() const
Get the hour in UTC.
unsigned local_month() const
Get the month in local time, range 1-12.
static void set_digits(unsigned num)
Set number of digits to use when printing (for fractions of seconds)
bool operator>=(absolute_time that) const
Compare two moments.
friend std::ostream & operator<<(std::ostream &s, absolute_time t)
Write the time to a std::ostream.
absolute_time operator-(relative_time that) const
Subtract an interval from this moment.
unsigned local_days() const
Get the day of the year in local time, range 0-365.
unsigned local_year() const
Get the year in local time.
unsigned month() const
Get the month in UTC, range 1-12.
unsigned year() const
Get the year in UTC.
The absolute_time class stores a date and time.
Definition: time.hh:36
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.
unsigned local_day() const
Get the day of the month in local time, range 1-31.
unsigned second() const
Get the seconds in UTC.
unsigned days() const
Get the day of the year in UTC, range 0-365.
absolute_time & operator-=(relative_time that)
Subtract an interval from this moment.
timetype total() const
Total number of seconds since january 1970, as encoded.
absolute_time & operator+=(relative_time that)
Add an interval to this moment.
unsigned minute() const
Get the minutes in UTC.
unsigned weekday() const
Get the day of the week in UTC, range 0-6 where 0 means sunday.
unsigned local_hour() const
Get the hour in local time.
unsigned day() const
Get the day of the month in UTC, range 1-31.
unsigned nanoseconds() const
Get the nanoseconds.