snark
Public Member Functions | List of all members
clocked_time_stamp Class Reference

#include <clocked_time_stamp.h>

Inherits noncopyable.

Public Member Functions

boost::posix_time::ptime adjusted (const boost::posix_time::ptime &t, std::size_t ticks=1)
boost::posix_time::ptime adjusted (const boost::posix_time::ptime &t, boost::posix_time::time_duration period, std::size_t ticks=1)
 clocked_time_stamp (boost::posix_time::time_duration period)
 constructor, takes event period
boost::posix_time::time_duration period () const
 return current period
void reset ()
 reset the approximation
 ~clocked_time_stamp ()
 destructor

Detailed Description

Helps calculate a better approximation for the timestamp that happens with a very frequency (e.g. laser firing).

The first few timestamps may be inaccurate, but eventually (quite fast, if the system is not under heavy load) the adjusted timestamp will converge to the true time of event plus a constant system latency (e.g. time to receive a data packet through a certain bandwidth).

Assumptions:

Member Function Documentation

boost::posix_time::ptime adjusted ( const boost::posix_time::ptime &  t,
std::size_t  ticks = 1 
)

take event reception timestamp and return adjusted timestamp; ticks are the number of clock cycles between this event and the previous one

boost::posix_time::ptime adjusted ( const boost::posix_time::ptime &  t,
boost::posix_time::time_duration  period,
std::size_t  ticks = 1 
)

take event reception timestamp and return adjusted timestamp, using new value for the period; ticks are the number of clock cycles between this event and the previous one

Note
: this method accounts for small slow variations of the period over long time, for example variations of clocking frequency due to the change of the ambient temperature

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