Boost logo

Boost :

Subject: Re: [boost] [date_time] Ordering non-overlapping time period
From: Arindam Mukherjee (arindam.mukerjee_at_[hidden])
Date: 2015-04-28 02:09:23


On Tue, Apr 28, 2015 at 11:33 AM, Arindam Mukherjee
<arindam.mukerjee_at_[hidden]> wrote:
> The documentation for time_period suggests that for two periods tp1
> and tp2, tp1 < tp2 if tp1.end() < tp2.begin() i.e.
> !tp1.intersects(tp2).
>
> http://www.boost.org/doc/libs/1_58_0/doc/html/date_time/posix_time.html#date_time.posix_time.time_period
>
> But I can see that the following works:
>
> time_period tp1(second_clock:local_time(), hours(2));
> time_period tp2(second_clock:local_time() + hours(1), hours(2));
>
> assert(tp1.intersects(tp2));
> assert(tp1 < tp2);
>
> The behavior seems legit - tp1.begin() < tp2.begin()/ The
> documentation says nothing about overlapping periods.
>

That is incorrect - sorry about that. The behavior is exactly as
documented. But, this means that for overlapping periods like tp1 and
tp2 where tp1.begin() < tp2.begin() < tp1.end() < tp2.end(), the
following holds:

tp1 >= tp2

This seems counter-intuitive.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk