trick/trick_source/sim_services/Clock/include/GetTimeOfDayClock.hh
Alex Lin 14a75508a3 Cleaning up once include variables and copyright cleanup.
Changed all header file once include variables to follow the same naming
convention and not start with any underscores.  Also deleted old
incorrect copyright notices.  Also removed $Id: tags from all files.

Fixes #14.  Fixes #22.
2015-03-23 16:03:14 -05:00

66 lines
1.6 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++)))
*/
#ifndef GETTIMEOFDAYCLOCK_HH
#define GETTIMEOFDAYCLOCK_HH
#ifdef __linux
#include <time.h>
#endif
#include "sim_services/Clock/include/Clock.hh"
namespace Trick {
/* enum ClockID remains until we are using python 3.x where
these values are available in the time module. Delete this
when everybody is using python 3.
*/
#ifdef __linux
enum ClockID {
TRICK_CLOCK_REALTIME = CLOCK_REALTIME ,
TRICK_CLOCK_MONOTONIC = CLOCK_MONOTONIC ,
TRICK_CLOCK_MONOTONIC_RAW = CLOCK_MONOTONIC_RAW
} ;
#endif
class GetTimeOfDayClock : public Clock {
public:
GetTimeOfDayClock() ;
~GetTimeOfDayClock() ;
/** @copybrief Trick::Clock::clock_init() */
virtual int clock_init() ;
/** @copybrief Trick::Clock::wall_clock_time() */
virtual long long wall_clock_time() ;
/** @copybrief Trick::Clock::clock_stop() */
virtual int clock_stop() ;
/** Sets the clock ID (system clock type), only for linux */
void set_clock_ID( int id ) ;
/** Gets the current clock ID (system clock type), only for linux */
int get_clock_ID() ;
protected:
#ifdef __linux
clockid_t clk_id ;
#endif
} ;
}
#endif