mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[HAL:APIC] Fix HalSetTimeIncrement
Fix calculation of clock rate. Previously it would go above the maximum, causing issues with KeUpdateSystemTime.
This commit is contained in:
parent
e8b88cf879
commit
365c2c1ce3
1 changed files with 6 additions and 5 deletions
|
@ -31,7 +31,7 @@ static BOOLEAN HalpSetClockRate;
|
||||||
static UCHAR HalpNextClockRate;
|
static UCHAR HalpNextClockRate;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Converts the CMOS RTC rate into the time increment in 100ns intervals.
|
\brief Converts the CMOS RTC rate into the time increment in 0.1ns intervals.
|
||||||
|
|
||||||
Rate Frequency Interval (ms) Precise increment (0.1ns)
|
Rate Frequency Interval (ms) Precise increment (0.1ns)
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
|
@ -222,14 +222,15 @@ NTAPI
|
||||||
HalSetTimeIncrement(IN ULONG Increment)
|
HalSetTimeIncrement(IN ULONG Increment)
|
||||||
{
|
{
|
||||||
UCHAR Rate;
|
UCHAR Rate;
|
||||||
ULONG CurrentIncrement;
|
ULONG NextIncrement;
|
||||||
|
|
||||||
/* Lookup largest value below given Increment */
|
/* Lookup largest value below given Increment */
|
||||||
for (Rate = RtcMinimumClockRate; Rate <= RtcMaximumClockRate; Rate++)
|
for (Rate = RtcMinimumClockRate; Rate < RtcMaximumClockRate; Rate++)
|
||||||
{
|
{
|
||||||
/* Check if this is the largest rate possible */
|
/* Check if this is the largest rate possible */
|
||||||
CurrentIncrement = RtcClockRateToPreciseIncrement(Rate + 1) / 1000;
|
NextIncrement = RtcClockRateToPreciseIncrement(Rate + 1) / 1000;
|
||||||
if (Increment > CurrentIncrement) break;
|
if (NextIncrement > Increment)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the rate and tell HAL we want to change it */
|
/* Set the rate and tell HAL we want to change it */
|
||||||
|
|
Loading…
Reference in a new issue