The C Utility Toolkit
Main Page | Data Structures | File List | Data Fields | Globals

timer.h

Go to the documentation of this file.
00001 /* 00002 ** This file is part of the C Utility Toolkit (CUTK) 00003 ** Copyright (C) 2002-2005 Chris Osgood 00004 ** http://www.cutk.org 00005 ** 00006 ** This library is free software; you can redistribute it and/or 00007 ** modify it under the terms of the GNU Lesser General Public 00008 ** License as published by the Free Software Foundation; either 00009 ** version 2.1 of the License, or (at your option) any later version. 00010 ** 00011 ** This library is distributed in the hope that it will be useful, 00012 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 ** Lesser General Public License for more details. 00015 ** 00016 ** You should have received a copy of the GNU Lesser General Public 00017 ** License along with this library; if not, write to the Free Software 00018 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 ** 00020 ** Please report all bugs and problems to "bugs at cutk.org". 00021 */ 00022 00023 /* 00024 ** $Id: timer.h 7 2005-01-02 01:02:22Z chris $ 00025 */ 00026 00027 #ifndef __INCLUDE_TIMER_H__ 00028 #define __INCLUDE_TIMER_H__ 00029 00030 #ifdef _WIN32 00031 #define WIN32_LEAN_AND_MEAN 00032 #include <windows.h> 00033 #else 00034 #include <sys/time.h> 00035 #endif 00036 00037 #ifdef __cplusplus 00038 extern "C" { 00039 #endif 00040 00044 typedef enum TimerMode 00045 { 00046 TIMER_TICKS, 00047 TIMER_SECS, 00048 TIMER_FPS 00049 } TimerMode; 00050 00054 typedef struct Timer 00055 { 00056 #ifdef _WIN32 00057 LARGE_INTEGER tm; 00058 LARGE_INTEGER freq; 00059 LARGE_INTEGER elapsed; 00060 #else 00061 struct timeval tm; 00062 unsigned long freq; 00063 unsigned long elapsed; 00064 #endif 00065 char stopped; 00066 } Timer; 00067 00068 /* Function prototypes */ 00069 00070 void TimerStart(Timer* t); 00071 double TimerElapsed(Timer* t, TimerMode mode); 00072 double TimerEnd(Timer* t, TimerMode mode); 00073 00074 #ifdef __cplusplus 00075 } 00076 #endif 00077 00078 #endif /* __INCLUDE_TIMER_H__ */ 00079

Generated on Wed Jan 12 13:13:42 2005 for CUTK by doxygen 1.3.7