Fawkes API  Fawkes Development Version
fawkes::SimulatorTimeSource Class Reference

#include <>>

Inheritance diagram for fawkes::SimulatorTimeSource:

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...
 
- Public Member Functions inherited from fawkes::TimeSource
virtual ~TimeSource ()
 Destructor. More...
 

Detailed Description

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.

Author
Tim Niemueller

Definition at line 36 of file simts.h.

Constructor & Destructor Documentation

◆ SimulatorTimeSource()

fawkes::SimulatorTimeSource::SimulatorTimeSource ( )

Constructor.

Definition at line 48 of file simts.cpp.

◆ ~SimulatorTimeSource()

fawkes::SimulatorTimeSource::~SimulatorTimeSource ( )
virtual

Destructor.

Definition at line 57 of file simts.cpp.

References fawkes::Time::get_timeval().

Member Function Documentation

◆ conv_native_to_exttime()

timeval fawkes::SimulatorTimeSource::conv_native_to_exttime ( const timeval *  tv) const
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.

Parameters
tvtime in external time source native format
Returns
time in Fawkes comparable to other times generated using the external timesource.

Implements fawkes::TimeSource.

Definition at line 93 of file simts.cpp.

◆ conv_to_realtime()

timeval fawkes::SimulatorTimeSource::conv_to_realtime ( const timeval *  tv) const
virtual

Convert a time given w.r.t.

this time sources into system time.

Parameters
tvthe time to convert
Returns
the converted time

Implements fawkes::TimeSource.

Definition at line 72 of file simts.cpp.

◆ get_time()

void fawkes::SimulatorTimeSource::get_time ( timeval *  tv) const
virtual

Get the current time.

Parameters
tvthe current time is written to this timeval

Implements fawkes::TimeSource.

Definition at line 62 of file simts.cpp.

◆ set_sim_offset()

void fawkes::SimulatorTimeSource::set_sim_offset ( float  sim_offset)

Set simulation offset.

Parameters
sim_offsetsimulation offset in seconds.

Definition at line 115 of file simts.cpp.

◆ set_start()

void fawkes::SimulatorTimeSource::set_start ( float  initial_offset)

Set start time.

Parameters
initial_offsetinitial offset in seconds

Definition at line 103 of file simts.cpp.


The documentation for this class was generated from the following files: