mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-20 06:17:15 +01:00
[SF 2804457] DateTime::checkLimit looks wrong
This commit is contained in:
parent
5245543642
commit
29bd22fe69
@ -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
|
||||
|
||||
|
||||
|
@ -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()
|
||||
{
|
||||
checkLimit(_microsecond, _millisecond, 999);
|
||||
checkLimit(_millisecond, _second, 999);
|
||||
checkLimit(_second, _minute, 59);
|
||||
checkLimit(_minute, _hour, 59);
|
||||
checkLimit(_hour, _day, 23);
|
||||
checkLimit(_microsecond, _millisecond, 1000);
|
||||
checkLimit(_millisecond, _second, 1000);
|
||||
checkLimit(_second, _minute, 60);
|
||||
checkLimit(_minute, _hour, 60);
|
||||
checkLimit(_hour, _day, 24);
|
||||
|
||||
if (_day > daysOfMonth(_year, _month))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user