Opened 8 years ago

Closed 5 years ago

#11168 closed Bugs (fixed)

boost::date_time::subsecond_duration does not handle boost::date_time::special_values graceful

Reported by: ingo.loehken@… Owned by: James E. King, III
Milestone: Boost 1.67.0 Component: date_time
Version: Boost 1.57.0 Severity: Problem
Keywords: posix_time, date_time, neg_infin, pos_infin, not_a_data_time, special_values Cc:

Description

Hi,

I just was victim to using boost::date_time::millisec and others in an error prone way, by passing into special values like neg_infin as part of testing.

For me it should at least avoid such abuse at compile time, because such errors are quite hard to find. I already patched our code, so plz find patch attached.

Greetz, ILo.

Ofc one may also allow to pass in those special values into subsecond_duration.

Attachments (1)

25098.patch (1.8 KB ) - added by ingo.loehken@… 8 years ago.
quickfix

Download all attachments as: .zip

Change History (7)

by ingo.loehken@…, 8 years ago

Attachment: 25098.patch added

quickfix

comment:1 by viboes, 7 years ago

Component: Nonedate_time
Owner: set to az_sw_dude

comment:2 by James E. King, III, 5 years ago

Owner: changed from az_sw_dude to James E. King, III
Status: newassigned

comment:3 by James E. King, III, 5 years ago

This affects hours(), minutes(), seconds(), all of the sub-second duration constructors, and also the time_duration constructor itself, since boost::date_time::special_values is an enum and therefore converts automatically to an integral.

comment:5 by James E. King, III, 5 years ago

Milestone: To Be DeterminedBoost 1.67.0

comment:6 by James E. King, III, 5 years ago

Resolution: fixed
Status: assignedclosed

Fix merged to master; resolved.

Note: See TracTickets for help on using tickets.