Claypool

Courses

Publications

Students

Projects

Service

Downloads

Misc


Dragonfly: Clock.h Source File
Dragonfly 2.2
A text-based game engine

Clock.h

00001 ///
00002 /// The clock, for timing (such as the game loop)
00003 ///
00004 
00005 #ifndef __CLOCK_H__
00006 #define __CLOCK_H__
00007 
00008 #include <time.h>
00009 
00010 class Clock {
00011 
00012  protected:
00013   struct timespec prev_ts;
00014 
00015  public:
00016   /// Sets prev_ts to current time.
00017   Clock();
00018 
00019   /// Return time elapsed since delta() was called.
00020   /// Units are microseconds.
00021   long int delta(void);
00022 
00023   /// Return time elapsed since delta() was last called.
00024   /// Units are microseconds.
00025   long int split(void);
00026 
00027 };
00028 
00029 #endif // __CLOCK_H__
 All Classes Functions Variables Friends