00001 /*************************************************************************** 00002 timer.h - Timer 00003 ------------------- 00004 begin : Tue Nov 6 2001 00005 copyright : (C) 2001 by Reality Rift Studios 00006 email : mattias@realityrift.com 00007 *************************************************************************** 00008 00009 The contents of this file are subject to the Mozilla Public License Version 00010 1.1 (the "License"); you may not use this file except in compliance with 00011 the License. You may obtain a copy of the License at 00012 http://www.mozilla.org/MPL/ 00013 00014 Software distributed under the License is distributed on an "AS IS" basis, 00015 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 00016 for the specific language governing rights and limitations under the 00017 License. 00018 00019 The Original Code is the NeoEngine, timer.h 00020 00021 The Initial Developer of the Original Code is Mattias Jansson. 00022 Portions created by Mattias Jansson are Copyright (C) 2001 00023 Reality Rift Studios. All Rights Reserved. 00024 00025 ***************************************************************************/ 00026 00027 #ifndef __NETIMER_H 00028 #define __NETIMER_H 00029 00030 #include "base.h" 00031 00032 00039 namespace NeoEngine 00040 { 00041 00042 00056 class NEOENGINE_API Timer 00057 { 00058 friend class Core; 00059 00060 protected: 00061 00063 uint64_t m_uliOldClock; 00064 00066 static uint64_t s_uliOldHeartbeatClock; 00067 00069 static uint64_t s_uliHeartbeat; 00070 00072 static uint64_t s_uliDivisor; 00073 00074 00075 public: 00076 00079 Timer(); 00080 00085 float GetDeltaTime( bool bReset = true ); 00086 00090 void Reset(); 00091 00095 static uint64_t GetHeartbeat(); 00096 00100 static uint64_t GetHeartbeatDivisor(); 00101 }; 00102 00103 00104 }; // namespace NeoEngine 00105 00106 00107 #endif // __NETIMER_H