trick/trick_source/sim_services/Timer/include/ITimer.hh
2015-02-26 09:02:31 -06:00

72 lines
1.7 KiB
C++

/*
PURPOSE:
( gettimeofday Clock )
PROGRAMMERS:
(((Robert W. Bailey) (LinCom) (April 1992) (--) (Realtime.))
((Robert W. Bailey) (LinCom) (7/22/92) (--) (--))
((Eddie J. Paddock) (MDSSC) (Oct 1992) (--) (Realtime.))
((Alex Lin) (NASA) (April 2009) (--) (port to c++)))
*/
/*
* $Id: ITimer.hh 2640 2012-09-28 15:39:38Z alin $
*/
#ifndef _ITIMER_HH_
#define _ITIMER_HH_
#include <time.h>
#include <sys/time.h>
#include <semaphore.h>
#include <string>
#include "Timer.hh"
namespace Trick {
class ITimer : public Timer {
public:
ITimer() ;
~ITimer() ;
/** Post the semaphore value from the interrupt handler */
void semaphore_post() ;
/** @copybrief Trick::Timer::init() */
virtual int init() ;
/** @copybrief Trick::Timer::start() */
virtual int start(double frame_time) ;
/** @copybrief Trick::Timer::reset() */
virtual int reset(double frame_time) ;
/** @copybrief Trick::Timer::stop() */
virtual int stop() ;
/** @copybrief Trick::Timer::pause() */
virtual int pause() ;
/** @copybrief Trick::Timer::shutdown() */
virtual int shutdown() ;
protected:
struct timespec res; /* ** resolution of the clock */
struct timespec timeout; /* ** timeout value of some kind */
sem_t * semaphore; /* ** Posted by SIGALRM handler to tell sched loop to wake up. */
std::string sem_name ; /* ** name of the semaphore */
} ;
}
Trick::ITimer * get_itimer() ;
void it_handler(int sig) ;
#endif