本文整理汇总了C++中DTime::add方法的典型用法代码示例。如果您正苦于以下问题:C++ DTime::add方法的具体用法?C++ DTime::add怎么用?C++ DTime::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DTime
的用法示例。
在下文中一共展示了DTime::add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: totalTimeCurrentDay
DTime Task::totalTimeCurrentDay() const {
DateTime today = DateTime::today();
DateTime tomorrow = today.addDays(1);
DTime totalTime;
if (childCount() == 0) {
for (vector<TaskLog*>::iterator iterLog = _logs->begin(); iterLog != _logs->end(); iterLog++) {
TaskLog* log = *iterLog;
if (*log->start >= today) {
if (*log->end < tomorrow) {
totalTime.add((*log->end) - (*log->start));
} else {
totalTime.add((*log->end) - tomorrow);
}
}
}
} else {
vector<Task*> subtasks = children();
for (vector<Task*>::iterator iter = subtasks.begin(); iter != subtasks.end(); iter++) {
Task* sub = *iter;
totalTime.add(sub->totalTimeCurrentDay());
}
}
return totalTime;
}
示例2: totalTime
DTime Task::totalTime() const {
DTime result;
for (vector<TaskLog*>::iterator iterLog = _logs->begin(); iterLog != _logs->end(); iterLog++) {
TaskLog* log = *iterLog;
result.add((*log->end) - (*log->start));
}
vector<Task*> subtasks = children();
for (vector<Task*>::iterator iter = subtasks.begin(); iter != subtasks.end(); iter++) {
Task* sub = *iter;
result.add(sub->totalTime());
}
return result;
}
示例3: totalTimeCurrentWeek
DTime Task::totalTimeCurrentWeek() const {
DateTime startDayWeek = DateTime::startDayOfWeek();
DateTime startDayOfNextWeek = DateTime::startDayOfNextWeek();
DTime totalTime;
if (childCount() == 0) {
for (vector<TaskLog*>::iterator iterLog = _logs->begin(); iterLog != _logs->end(); iterLog++) {
TaskLog* log = *iterLog;
if ((*(log->start) >= startDayWeek) &&
(*(log->end) < startDayOfNextWeek)) {
totalTime.add((*log->end) - (*log->start));
}
}
} else {
vector<Task*> subtasks = children();
for (vector<Task*>::iterator iter = subtasks.begin(); iter != subtasks.end(); iter++) {
Task* sub = *iter;
totalTime.add(sub->totalTimeCurrentWeek());
}
}
return totalTime;
}