
On Nov 20, 2013, at 12:49 PM, Vicente J. Botet Escriba
Le 20/11/13 13:45, Krzysztof Czainski a écrit :
Hello,
The function boost::chrono::floor() is documented: "This function round down the given parameter." Therefore I expect the assert in the following program to pass, but it fails:
#include
#include <cassert> int main() { boost::chrono::nanoseconds const nsec( -1 ); boost::chrono::seconds const sec = boost::chrono::floorboost::chrono::seconds(nsec); assert( sec.count() == -1 ); }
Is this intended behavior? If yes, could the docs be updated to clarify this?
Hi,
no, there is a bug with negative numbers.
template
To floor(const duration & d) { + if (d ::zero()) + return duration_cast<To>(d)-To(1); + else return duration_cast<To>(d); } Please, coul dyou create a ticket so that I don't forget it.
Thanks, Vicente
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
#include <chrono>
using namespace std::chrono;
template