#include #include #include namespace xlnt { double timedelta::to_number() const { return days + hours / 24.0; } timedelta timedelta::from_number(long double number) { int days = static_cast(number); number -= days; number *= 24; int hours = static_cast(number); number -= hours; number *= 60; int minutes = static_cast(number); number -= minutes; number *= 60; int seconds = static_cast(number); number -= seconds; number *= 1000000; int microseconds = static_cast(number + 0.5); return timedelta(days, hours, minutes, seconds, microseconds); } } // namespace xlnt