25 #ifndef __UTILS_TIME_CLOCK_H_ 26 #define __UTILS_TIME_CLOCK_H_ 28 #include <utils/time/time.h> 58 void get_time(
struct timeval *tv)
const;
59 void get_time(
struct timeval *tv, TimesourceSelector sel)
const;
81 static Clock* _instance;
TimesourceSelector
Select the time source.
static Clock * instance()
Clock initializer.
void get_time(struct timeval *tv) const
Returns the time of the selected time source.
Fawkes library namespace.
void get_systime(struct timeval *tv) const
Returns the system time.
This is supposed to be the central clock in Fawkes.
bool is_ext_default_timesource() const
Checks whether the external time source is the default time soucre.
Time native_to_time(const Time &t)
Convert some native time to a Fawkes time.
float elapsed(Time *t) const
How much time has elapsed since t? Calculated as "now - t" in seconds.
A class for handling time.
bool has_ext_timesource() const
Check whether an external time source is registered.
virtual ~Clock()
Destructor.
void set_ext_default_timesource(bool ext_is_default)
Set/unset the external time source as the default time source.
Time now() const
Get the current time.
select the external time source
Time ext_to_realtime(const Time &t)
Convert a time given w.r.t.
select the system time source
void register_ext_timesource(TimeSource *ts, bool make_default=false)
Register an external time source.
static void finalize()
Finalize.
float sys_elapsed(Time *t) const
How much system time has elapsed since t? Use only for system time criteria like timeouts.
void remove_ext_timesource(TimeSource *ts=0)
Remove external time source.
select the default time source