csaStopwatch.h
Go to the documentation of this file.
00001 /* csaStopwatch.h
00002  */
00003 #ifndef GAME_PLAYING_CSASTOPWATCH_H
00004 #define GAME_PLAYING_CSASTOPWATCH_H
00005 #include "osl/misc/milliSeconds.h"
00006 
00007 namespace osl
00008 {
00009   namespace game_playing
00010   {
00011     class CsaStopwatch
00012     {
00013       MilliSeconds start;
00014     public:
00015       CsaStopwatch() : start(MilliSeconds::now())
00016       {
00017       }
00018       int read() {
00019         double elapsed = start.elapsedSeconds();
00020         int ret = (int)floor(elapsed);
00021         return std::max(1, ret);
00022       }
00023     };
00024   } // namespace game_playing
00025 } // namespace osl
00026 
00027 
00028 #endif /* GAME_PLAYING_CSASTOPWATCH_H */
00029 // ;;; Local Variables:
00030 // ;;; mode:c++
00031 // ;;; c-basic-offset:2
00032 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines