11#include <tools/datetime.hxx>
12#include <rtl/math.hxx>
19 : mnDays(static_cast<const
Date&>(rEnd) - static_cast<const
Date&>(rStart))
26 const sal_uInt16 nStartHour = rStart.
GetHour();
27 const sal_uInt16 nEndHour = rEnd.
GetHour();
28 if (nStartHour >= 24 || nEndHour >= 24)
39 mnDays -= (nStartHour / 24) * (aStart.
GetTime() < 0 ? -1 : 1);
40 aStart.
SetHour(nStartHour % 24);
53 if (fTimeInDays < 0.0)
55 fInt = ::rtl::math::approxCeil(fTimeInDays);
56 fFrac = fInt <= fTimeInDays ? 0.0 : fTimeInDays - fInt;
60 fInt = ::rtl::math::approxFloor(fTimeInDays);
61 fFrac = fInt >= fTimeInDays ? 0.0 : fTimeInDays - fInt;
63 mnDays =
static_cast<sal_Int32
>(fInt);
67 fFrac = ::rtl::math::approxFloor(fFrac);
68 sal_Int64 nNS =
static_cast<sal_Int64
>(fFrac);
74 nNS -= (nNS < 0) ? -1 : 1;
77 nNS += (nNS < 0) ? -1 : 1;
92 assert(nDays == 0 || rTime.
GetTime() == 0 || (nDays < 0) == (rTime.
GetTime() < 0));
94 ((nDays < 0) || (rTime.
GetTime() < 0)));
98 sal_uInt64 nNanoseconds)
101 Normalize(nHours, nMinutes, nSeconds, nNanoseconds, nDays < 0);
111 sal_uInt64 nNanoseconds,
bool bNegative)
132 bool bOverflow =
false;
157 maTime =
Time(nHours, nMinutes, nSeconds, nNanoseconds);
165 if (
mnDays > 0 && nNS < 0)
170 else if (mnDays < 0 && nNS > 0)
221 bBadNS = rbOverflow =
true;
232 Duration aD(
static_cast<sal_Int32
>(nD), 0);
241 const sal_uInt64 nMult64 = (nMult < 0) ? -nMult : nMult;
258 mnDays < 0 ?
static_cast<sal_uInt64
>(-
static_cast<sal_Int64
>(
mnDays))
259 :
static_cast<sal_uInt64
>(
mnDays),
296 Time aTime(nH, nM, nS, nN);
Represents a date in the proleptic Gregorian calendar.
Degree100 abs(Degree100 x)
std::enable_if< std::is_signed< T >::value, bool >::type checked_add(T a, T b, T &result)
std::enable_if< std::is_signed< T >::value, bool >::type checked_multiply(T a, T b, T &result)
std::enable_if< std::is_signed< T >::value, bool >::type checked_sub(T a, T b, T &result)