예제 #1
0
/**  Returns an intersection of this interval with \a ti
     @param ti :: Time interval
     @return A valid time interval if this interval intersects with \a ti or
             an empty interval otherwise.
 */
TimeInterval TimeInterval::intersection(const TimeInterval& ti)const
{
    if (!isValid() || !ti.isValid()) return TimeInterval();

    DateAndTime t1 = begin();
    if (ti.begin() > t1) t1 = ti.begin();

    DateAndTime t2 = end();
    if (ti.end() < t2) t2 = ti.end();

    return t1 < t2? TimeInterval(t1,t2) : TimeInterval();

}
예제 #2
0
bool OrgMode::operator==(const TimeInterval &left, const OrgMode::TimeInterval &right)
{
    return left.start() == right.start() && left.end() == right.end();
}