Subject: [boost] [chrono] boost::chrono::floor() and negative durations
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2013-11-20 07:45:59


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 <boost/chrono/floor.hpp>
#include <cassert>

int main()
{
    boost::chrono::nanoseconds const nsec( -1 );
    boost::chrono::seconds const sec =
boost::chrono::floor<boost::chrono::seconds>(nsec);
    assert( sec.count() == -1 );
}

Is this intended behavior? If yes, could the docs be updated to clarify
this?

Regards,
Kris