mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01:00
[SF 2804457] DateTime::checkLimit looks wrong
This commit is contained in:
@@ -427,6 +427,16 @@ inline void swap(DateTime& d1, DateTime& d2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void DateTime::checkLimit(short& lower, short& higher, short limit)
|
||||||
|
{
|
||||||
|
if (lower >= limit)
|
||||||
|
{
|
||||||
|
higher += short(lower / limit);
|
||||||
|
lower = short(lower % limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -335,23 +335,13 @@ double DateTime::toJulianDay(int year, int month, int day, int hour, int minute,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DateTime::checkLimit(short& lower, short& higher, short limit)
|
|
||||||
{
|
|
||||||
if (lower > limit)
|
|
||||||
{
|
|
||||||
higher += short(lower / limit);
|
|
||||||
lower = short((lower % limit) - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DateTime::normalize()
|
void DateTime::normalize()
|
||||||
{
|
{
|
||||||
checkLimit(_microsecond, _millisecond, 999);
|
checkLimit(_microsecond, _millisecond, 1000);
|
||||||
checkLimit(_millisecond, _second, 999);
|
checkLimit(_millisecond, _second, 1000);
|
||||||
checkLimit(_second, _minute, 59);
|
checkLimit(_second, _minute, 60);
|
||||||
checkLimit(_minute, _hour, 59);
|
checkLimit(_minute, _hour, 60);
|
||||||
checkLimit(_hour, _day, 23);
|
checkLimit(_hour, _day, 24);
|
||||||
|
|
||||||
if (_day > daysOfMonth(_year, _month))
|
if (_day > daysOfMonth(_year, _month))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user