summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/boot/i386/libi386/time.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/boot/i386/libi386/time.c b/sys/boot/i386/libi386/time.c
index 183ac3c..c27dcf6 100644
--- a/sys/boot/i386/libi386/time.c
+++ b/sys/boot/i386/libi386/time.c
@@ -62,7 +62,7 @@ bios_seconds(void)
* Some BIOSes (notably qemu) don't correctly read the RTC
* registers in an atomic way, sometimes returning bogus values.
* Therefore we "debounce" the reading by accepting it only when
- * we got two identical values in succession.
+ * we got 8 identical values in succession.
*
* If we pass midnight, don't wrap back to 0.
*/
@@ -71,14 +71,16 @@ time(time_t *t)
{
static time_t lasttime;
time_t now, check;
- int try;
+ int same, try;
- try = 0;
+ same = try = 0;
check = bios_seconds();
do {
now = check;
check = bios_seconds();
- } while (now != check && ++try < 1000);
+ if (check != now)
+ same = 0;
+ } while (++same < 8 && ++try < 1000);
if (now < lasttime)
now += 24 * 3600;
OpenPOWER on IntegriCloud