fawkes::SimulatorTimeSource Class Reference

Simulation time source. More...

#include <utils/time/simts.h>

Inheritance diagram for fawkes::SimulatorTimeSource:

[legend]
List of all members.

Public Member Functions

 SimulatorTimeSource ()
 Constructor.
virtual ~SimulatorTimeSource ()
 Destructor.
virtual void get_time (timeval *tv) const
 Get the current time.
virtual timeval conv_to_realtime (const timeval *tv) const
 Convert a time given w.r.t.
void set_start (float initial_offset)
 Set start time.
void set_sim_offset (float sim_offset)
 Set simulation offset.

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 32 of file simts.h.


Constructor & Destructor Documentation

fawkes::SimulatorTimeSource::SimulatorTimeSource (  ) 

Constructor.

Definition at line 43 of file simts.cpp.

References fawkes::Clock::get_systime(), and fawkes::Clock::instance().

fawkes::SimulatorTimeSource::~SimulatorTimeSource (  )  [virtual]

Destructor.

Definition at line 52 of file simts.cpp.


Member Function Documentation

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:
tv the time to convert
Returns:
the converted time

Implements fawkes::TimeSource.

Definition at line 69 of file simts.cpp.

References fawkes::Time::in_sec().

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

Get the current time.

Parameters:
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.

Parameters:
sim_offset simulation offset in seconds.

Definition at line 106 of file simts.cpp.

References fawkes::Clock::get_systime().

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

Set start time.

Parameters:
initial_offset initial offset in seconds

Definition at line 93 of file simts.cpp.

References fawkes::Clock::get_systime().


The documentation for this class was generated from the following files:
Generated on Tue Feb 22 13:32:55 2011 for Fawkes API by  doxygen 1.4.7