Cafu Engine
Util.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 /***************************************************/
8 /*** Small and Portable Utility Library (Header) ***/
9 /***************************************************/
10 
11 #ifndef CAFU_UTIL_HPP_INCLUDED
12 #define CAFU_UTIL_HPP_INCLUDED
13 
14 #ifndef _WIN32
15 #define _stricmp strcasecmp
16 #define _strnicmp strncasecmp
17 #define _getch getchar
18 typedef long long int __int64;
19 #endif
20 
21 
22 /// A platform independent timer class that allows to measure the time passed since
23 /// its construction or the last measuring point.
24 class TimerT
25 {
26  private:
27 
28  double Frequency;
29  __int64 TimeStamp1st;
30  __int64 TimeStampOld;
31 
32 
33  public:
34 
35  /// The constructor. It initializes the timer.
36  TimerT();
37 
38  /// This function returns the time elapsed since the function was last called.
39  /// The return value is the elapsed time in seconds.
40  /// The very first call of this function returns always 0.
41  double GetSecondsSinceLastCall();
42 
43  /// This function returns the time elapsed since the timer was constructed.
44  /// The return value is the elapsed time in seconds.
45  double GetSecondsSinceCtor() const;
46 };
47 
48 
49 // Given a string of the form "path/filename.extension" (where individual parts may be missing),
50 // this functions strips off the file extension, including the '.' character.
51 // This is done by inserting a '\0' character in the right place.
52 // void StripExt(char* PathFileExt);
53 
54 // Given a string of the form "path/filename.extension" (where individual parts may be missing),
55 // this functions strips off the file name, the file extension, and the possibly preceding '/' or '\\' character.
56 // This is done by inserting a '\0' character in the right place.
57 // WARNING: This is pretty problematic when no '/' or '\\' was given!
58 // void StripFileNameAndExt(char* PathFileExt);
59 
60 #endif
double GetSecondsSinceCtor() const
This function returns the time elapsed since the timer was constructed.
Definition: Util.cpp:69
double GetSecondsSinceLastCall()
This function returns the time elapsed since the function was last called.
Definition: Util.cpp:43
TimerT()
The constructor. It initializes the timer.
Definition: Util.cpp:21
A platform independent timer class that allows to measure the time passed since its construction or t...
Definition: Util.hpp:24