00001 
00002 
00003 
00004 
00005 #ifndef COURNIA_CLOCKER_H
00006 #define COURNIA_CLOCKER_H 1
00007 
00008 #include "config.h"
00009 
00010 #ifdef HAVE_SDL
00011 #include "SDL.h"
00012 #else
00013 #include <sys/time.h>
00014 #endif
00015 
00017 
00021 class clocker
00022 {
00023 private:
00024 #ifdef HAVE_SDL
00025         Uint32 last;
00026 #else
00027         struct timeval *clock;
00028         struct timeval *now;
00029 #endif
00030         double m_elapsed;
00031 
00032         
00033         clocker( const clocker &cpy );
00034         clocker& operator= ( clocker &rhs );
00035 
00036 public:
00038         clocker( void );
00039         
00041         ~clocker( void );
00042         
00044 
00047         void reset( void );
00048         
00050 
00054         void update( void );
00055         
00056         
00058         inline double elapsed( ) const {
00059                 return m_elapsed;
00060         }
00061 };
00062 
00063 #endif