Boost logo

Boost :

From: Bart (bartmann.nsd_at_[hidden])
Date: 2005-06-08 13:09:12

On Wed, 08 Jun 2005 12:35:31 -0400, Caleb Epstein wrote:

> I think the specification of "fractional_seconds" in the time_duration
> class is unclear. Using the multi-argument constructor, and passing
> 1000 for the 4th argument, am I specifying milliseconds? Microseconds?
> Does it depend on the compile-time resolution of the class? If so
> (which is my suspicion), then using the 4-argument form of the ctor
> can lead to incorrect results if the resolution is changed. That
> seems like a bad thing.

Yes it does depend on the compile time resolution. In the following:
 time_duration td(1,2,3,1000);
The fractional_seconds parameter is 1000 units. That may be 1000
microseconds or 1000 nanoseconds.

In cases where the fractional_seconds exceeds the compiled resolution, the
extra value is carried over into the seconds field:
 time_duration td(1,2,3,123456789);
When compiled with microsecond resolution produces "01:04:06.456789".

I've updated the documentation to try and make this behavior more clear.
Thanks for bringing this to our attention.

Jeff will have to address the floating point issue.


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