Fawkes API
Fawkes Development Version
|
Simulation time source. More...
#include <>>
Public Member Functions | |
SimulatorTimeSource () | |
Constructor. More... | |
virtual | ~SimulatorTimeSource () |
Destructor. More... | |
virtual void | get_time (timeval *tv) const |
Get the current time. More... | |
virtual timeval | conv_to_realtime (const timeval *tv) const |
Convert a time given w.r.t. More... | |
virtual timeval | conv_native_to_exttime (const timeval *tv) const |
Convert a native time to the external time. More... | |
void | set_start (float initial_offset) |
Set start time. More... | |
void | set_sim_offset (float sim_offset) |
Set simulation offset. More... | |
![]() | |
virtual | ~TimeSource () |
Destructor. More... | |
Simulation time source.
This class is an utility to provide a generic time source for time in a simulated environment. It can be restarted at an arbitrary time with an arbitrary offset. It will then read the current real system time and save the initial offset. Each time you query the time source it will return a given fixed time. The time is advanced by setting a new offset (usually in every cycle).
This implementation is rather primitive at the moment and could use some love.
fawkes::SimulatorTimeSource::SimulatorTimeSource | ( | ) |
Constructor.
Definition at line 43 of file simts.cpp.
References fawkes::Clock::get_systime(), and fawkes::Clock::instance().
|
virtual |
|
virtual |
Convert a native time to the external time.
When communicating with another instance which provides times in some timeformat native to the underlying time source (e.g. received from a simulation) it must be converted to a Fawkes time.
tv | time in external time source native format |
Implements fawkes::TimeSource.
|
virtual |
Convert a time given w.r.t.
this time sources into system time.
tv | the time to convert |
Implements fawkes::TimeSource.
Definition at line 69 of file simts.cpp.
References fawkes::Time::in_sec().
|
virtual |
Get the current time.
tv | the current time is written to this timeval |
Implements fawkes::TimeSource.
Definition at line 58 of file simts.cpp.
References fawkes::Time::get_timeval().
void fawkes::SimulatorTimeSource::set_sim_offset | ( | float | sim_offset | ) |
Set simulation offset.
sim_offset | simulation offset in seconds. |
Definition at line 113 of file simts.cpp.
References fawkes::Clock::get_systime().
void fawkes::SimulatorTimeSource::set_start | ( | float | initial_offset | ) |
Set start time.
initial_offset | initial offset in seconds |
Definition at line 100 of file simts.cpp.
References fawkes::Clock::get_systime().