schedule.cpp
来自「dk1游戏的原代码文件,完整.编译系统redhat7.3,mysql 3.23 」· C++ 代码 · 共 93 行
CPP
93 行
///////////////////////////////////////////////////////////////////// 胶纳临傅等 累诀阑 困茄 Schedule 努贰胶 备泅///////////////////////////////////////////////////////////////////#include "Exception.h"#include "Work.h"#include "StringStream.h"#include "Schedule.h"Schedule::Schedule( Work* pWork, const VSDateTime& Time, ScheduleType type ) throw(): m_ScheduleType( type ), m_pWork( pWork ), m_ScheduledTime( Time ){ __BEGIN_TRY //m_LimitCheckDateTime = VSDateTime::currentDateTime().addDays(1); //m_LimitCheckTime = VSTime::currentTime().addSecs(60);// m_WrongCount = 0; __END_CATCH}Schedule::~Schedule() throw(){ __BEGIN_TRY SAFE_DELETE(m_pWork); __END_CATCH}Work*Schedule::popWork(){ Work* pWork = m_pWork; m_pWork = NULL; return pWork;}bool Schedule::heartbeat() throw(Error){ __BEGIN_TRY //VSDateTime current( VSDateTime::currentDateTime() ); VSDate cd = VSDate::currentDate(); VSTime ct = VSTime::currentTime(); VSDateTime current = VSDateTime( cd, ct ); if( current >= m_ScheduledTime ) { filelog("Schedule.txt", "Execute(%s >= %s) : %s", current.toString().c_str(), m_ScheduledTime.toString().c_str(), m_pWork->toString().c_str()); m_pWork->execute(); return true; } return false; __END_CATCH}string Schedule::toString() const throw (Error){ __BEGIN_TRY StringStream msg; msg << "Schedule(" << "ScheduleType:" << (int)m_ScheduleType << ",ScheduledTime:" << m_ScheduledTime.toString(); if (m_pWork==NULL) msg << ",Work:NULL"; else msg << ",Work:" << m_pWork->toString(); msg << ")"; return msg.toString(); __END_CATCH}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?