gtimer.cpp

来自「一个由Mike Gashler完成的机器学习方面的includes neural」· C++ 代码 · 共 36 行

CPP
36
字号
/*	Copyright (C) 2006, Mike Gashler	This library is free software; you can redistribute it and/or	modify it under the terms of the GNU Lesser General Public	License as published by the Free Software Foundation; either	version 2.1 of the License, or (at your option) any later version.	see http://www.gnu.org/copyleft/lesser.html*/#include "GMacros.h"#include "GTimer.h"#ifdef WIN32#include <windows.h>#endif // WIN32GTimer::GTimer(int nFramesPerSecond){	m_nClock = 0;	__int64 nTicksPerSecond;	if(!QueryPerformanceFrequency((LARGE_INTEGER*)&nTicksPerSecond))		GAssert(false, "Error querying timer");	m_nTicksPerFrame = nTicksPerSecond / nFramesPerSecond;}bool GTimer::IsItTimeYet(){	__int64 nClock;	QueryPerformanceCounter((LARGE_INTEGER*)&nClock);	if(nClock - m_nClock < m_nTicksPerFrame)		return(false);	m_nClock = nClock;	return(true);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?