Boost logo

Boost :

Subject: [boost] Bug in date_time::subsecond_duration
From: Jon Spencer (dev_at_[hidden])
Date: 2009-09-05 20:12:22

There is a needless loss of range in the constructor of
date_time::subsecond_duration. The argument is multiplied by the
resolution of the base_duration, which could potentially overflow, and
then divided by frac_of_second. The patch below reduces the amount of
overflow and is identical if one resolution is an integer multiple of
the other. The same technique is used elsewhere in the file.

Also see this posting on the subject

--- boost/date_time/time_duration.hpp
+++ boost/date_time/time_duration.hpp
@@ -267,7 +267,7 @@
     typedef typename base_duration::traits_type traits_type;
     explicit subsecond_duration(boost::int64_t ss) :
- base_duration(0,0,0,ss*traits_type::res_adjust()/frac_of_second)

Boost list run by bdawes at, gregod at, cpdaniel at, john at