PosixTimespec.cpp
//==============================================================================
// Sets timespec based on provided double-precision floating point number
//==============================================================================
Sets timespec based on provided double-precision floating point number
Sets timespec based on provided double - precision floating point number
bool PosixTimespec::fromDouble(double tp_dbl)
{
    if (tp_dbl < 0.0)
    {
        return false;
    }
    double integral_part = 0.0;
    double fractional_part = std::modf(tp_dbl, &integral_part);
    this->tp.tv_sec  = static_cast<time_t>(integral_part);
    this->tp.tv_nsec = fractional_part *
        static_cast<double>(nanoseconds_per_second);
    return true;
}
bool PosixTimespec :: fromDouble ( double tp_dbl ) { if ( tp_dbl < 0.0 ) { return false ; } double integral_part = 0.0 ; double fractional_part = std :: modf ( tp_dbl , & integral_part ) ; this -> tp . tv_sec = static_cast < time_t > ( integral_part ) ; this -> tp . tv_nsec = fractional_part * static_cast < double > ( nanoseconds_per_second ) ; return true ; }
Sets timespec based on provided double-precision floating point number
Sets timespec based on provided double - precision floating point number
// This class can't represent values less than zero