本文整理汇总了C++中CDate::setDay方法的典型用法代码示例。如果您正苦于以下问题:C++ CDate::setDay方法的具体用法?C++ CDate::setDay怎么用?C++ CDate::setDay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDate
的用法示例。
在下文中一共展示了CDate::setDay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSameWeekDayOneYearLater
CDate CSeasonGenerator::getSameWeekDayOneYearLater(const CDate &date)
{
// To match the same week day one year later
// is necesary to look for leap years
CDate newDate = date;
newDate.setYear(newDate.getYear()+1);
if( CDate::isLeap(date.getYear()) ){
CDate Feb29(29, 02, date.getYear(), 23, 59, 59);
if( date<=Feb29 ){
newDate.setDay(newDate.getDay()-2);
}
else{
newDate.setDay(newDate.getDay()-1);
}
}
else{
if( CDate::isLeap(date.getYear()+1) ){
CDate Feb29(29, 02, date.getYear()+1, 23, 59, 59);
if( newDate>Feb29 ){
newDate.setDay(newDate.getDay()-2);
}
else{
newDate.setDay(newDate.getDay()-1);
}
}
else{
newDate.setDay(newDate.getDay()-1);
}
}
return newDate;
}
示例2: endDayEventHandler
void CTimeManager::endDayEventHandler(const IGameEvent &event)
{
// Only one "NoMoreEventsToday" event is on the events queue at time,
// so we need to add a new event of this type for tomorrow
CDate date = event.getDate();
date.setDay(date.getDay()+1);
date.setHour(23);
date.setMin(59);
date.setSec(59);
CGameEngine::getInstance()->getEventManager()->addEvent(new CEndDayEvent(date));
}