Error in CMOS Time and Date code?
Posted: Tue Aug 27, 2013 7:33 am
Can someone take a look at this page:
http://wiki.osdev.org/CMOS
go down to the C code example with the heading "Reading All RTC Time and Date Registers". Now look at the do-while loop which contains the comment "This uses the "read registers until you get the same values twice in a row". Is the condition in the do-while loop not wrong? instead of
would you not want its negation:
http://wiki.osdev.org/CMOS
go down to the C code example with the heading "Reading All RTC Time and Date Registers". Now look at the do-while loop which contains the comment "This uses the "read registers until you get the same values twice in a row". Is the condition in the do-while loop not wrong? instead of
Code: Select all
} while( (last_second == second) && (last_minute == minute) && (last_hour == hour) &&
(last_day == day) && (last_month == month) && (last_year == year) &&
(last_century == century) );
Code: Select all
} while( ! (last_second == second) && (last_minute == minute) && (last_hour == hour) &&
(last_day == day) && (last_month == month) && (last_year == year) &&
(last_century == century) );