本文整理汇总了C++中DateTime::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ DateTime::Add方法的具体用法?C++ DateTime::Add怎么用?C++ DateTime::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTime
的用法示例。
在下文中一共展示了DateTime::Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WHERE
void DBMaintenance::Do1DayMaintenance()
{
DateTime yesterday;
DateTime tendaysago;
yesterday.Add(0,0,0,-1);
tendaysago.Add(0,0,0,-10);
m_db->Execute("BEGIN;");
SQLite3DB::Statement st=m_db->Prepare("DELETE FROM tblIdentity WHERE (DateAdded<? AND LastSeen IS NULL) OR LastSeen<? AND Ignored=0;");
st.Bind(0,tendaysago.Format("%Y-%m-%d"));
st.Bind(1,tendaysago.Format("%Y-%m-%d"));
st.Step();
st=m_db->Prepare("DELETE FROM tblAnnounceIndex WHERE Date<?;");
st.Bind(0,yesterday.Format("%Y-%m-%d"));
st.Step();
st=m_db->Prepare("DELETE FROM tblIdentityEdition WHERE Date<?;");
st.Bind(0,yesterday.Format("%Y-%m-%d"));
st.Step();
st=m_db->Prepare("DELETE FROM tblInsertedMessageIndex WHERE Date<?;");
st.Bind(0,yesterday.Format("%Y-%m-%d"));
st.Step();
st=m_db->Prepare("DELETE FROM tblRetrievedMessageIndex WHERE Date<?;");
st.Bind(0,yesterday.Format("%Y-%m-%d"));
st.Step();
m_db->Execute("COMMIT;");
m_log->Error("DBMaintenance::Do1DayMaintenance");
}
示例2: Process
void DBMaintenance::Process()
{
DateTime now;
DateTime sixhoursago;
DateTime onedayago;
sixhoursago.Add(0,0,-6);
onedayago.Add(0,0,0,-1);
if(m_last6hourmaintenance<sixhoursago)
{
Do6HoursMaintenance();
m_last6hourmaintenance.SetNowUTC();
}
if(m_last1daymaintenance<onedayago)
{
Do1DayMaintenance();
m_last1daymaintenance.SetNowUTC();
}
}