📄 timeout.cpp
字号:
// TimeOut.cpp: implementation of the CTimeOut class.
//
//////////////////////////////////////////////////////////////////////
#include "windows.h"
#include "TimeOut.h"
//////////////////////////////////////////////////////////////////////
// CTimeOut
//////////////////////////////////////////////////////////////////////
// 带时间积累的定时时钟
bool CTimeOut::ToNextTick(int nSecs)
{
if(IsTimeOut(nSecs))
{
if(time(NULL) >= m_tUpdateTime + nSecs*2)
return Update(),true;
else
return (m_tUpdateTime+=nSecs),true;
}
else
return false;
}
//////////////////////////////////////////////////////////////////////
// CTimeOutMS
//////////////////////////////////////////////////////////////////////
// 带时间积累的定时时钟
bool CTimeOutMS::ToNextTick(int nMilliSecs)
{
if(IsTimeOut(nMilliSecs))
{
if(clock() >= m_tUpdateTime + nMilliSecs*2)
return Update(),true;
else
return (m_tUpdateTime+=nMilliSecs),true;
}
else
return false;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -