All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
csaStopwatch.h
Go to the documentation of this file.
1 /* csaStopwatch.h
2  */
3 #ifndef GAME_PLAYING_CSASTOPWATCH_H
4 #define GAME_PLAYING_CSASTOPWATCH_H
6 
7 namespace osl
8 {
9  namespace game_playing
10  {
12  {
13  MilliSeconds start;
14  public:
15  CsaStopwatch() : start(MilliSeconds::now())
16  {
17  }
18  int read() {
19  double elapsed = start.elapsedSeconds();
20  int ret = (int)floor(elapsed);
21  return std::max(1, ret);
22  }
23  };
24  } // namespace game_playing
25 } // namespace osl
26 
27 
28 #endif /* GAME_PLAYING_CSASTOPWATCH_H */
29 // ;;; Local Variables:
30 // ;;; mode:c++
31 // ;;; c-basic-offset:2
32 // ;;; End: