Opened 6 years ago

#12963 new Bugs

boost::time_period::span() returns invalid period if one of the periods is not-a-date-time

Reported by: willi.burkhardt@… Owned by: az_sw_dude
Milestone: To Be Determined Component: date_time
Version: Boost 1.62.0 Severity: Problem
Keywords: time_period span Cc:

Description

In some cases, the time_period::span() function returns a less than optimal result. The expected behavior is that if one of the two periods is invalid/not-a-date-time the other is returned.

What I observed is that if one of the two source periods is not-a-date-time, the length() of the period returned is wrong/broken; invalidating the resulting time_period.

I might be wrong with my expectation above, but in this case it should be at least documented. Attached is a global function that I use to "fix" it in my code.

Attachments (1)

utilities_ptime.cpp (1002 bytes ) - added by Willi Burkhardt <willi.burkhardt@…> 6 years ago.
global function that I use as workaround for the problem

Download all attachments as: .zip

Change History (1)

by Willi Burkhardt <willi.burkhardt@…>, 6 years ago

Attachment: utilities_ptime.cpp added

global function that I use as workaround for the problem

Note: See TracTickets for help on using tickets.