// // Linux Daemon // /* prevent multiple inclusions */ #ifndef __Clock__ #define __Clock__ /* includes *****************************************************************/ #include #include #include #include #include #include #include /* defines ******************************************************************/ /* macros *******************************************************************/ /* structs & typedefs *******************************************************/ /* c class definitions ******************************************************/ class Clock { // public data public: // protected data protected: struct timespec Time; // private data private: // public methods public: // constructors Clock(); Clock( time_t tic ); // destructor virtual ~Clock(); Clock( const Clock& ); const Clock& operator=( const Clock& ); // public methods time_t GetUtc( void ) { return Time.tv_sec; }; struct timespec GetTimeSpec() { return Time; }; int Format( char *buf, int max ); struct timespec Parse( const char *buf ); void SetTime( void ); void SetTime( time_t sec, suseconds_t usec=0L ); void SetTime( const struct timespec &tv ) { Time = tv; }; // microsecond time stamp unsigned long long GetTimeStamp(); void SetTimeStamp( unsigned long long ts ); // virtual functions // exceptions // static methods static int Format( const struct timespec &tv, char **buf, int *max ); // private methods private: // signal catchers (do not override) }; #endif