11#include < hw/cmos.hpp>
22#include < statman>
3+ #include " ../platform/x86_pc/acpi.hpp"
34
45using namespace hw ;
56uint8_t CMOS::reg_b_value = 0 ;
@@ -18,6 +19,7 @@ void CMOS::init()
1819CMOS::Time& CMOS::Time::hw_update () {
1920 // We're supposed to check this before every read
2021 while (update_in_progress ());
22+ const reg_t r_cent = x86::ACPI::get ().cmos_century ();
2123
2224 if (CMOS::mode_binary ()) {
2325 f.second = get (r_sec);
@@ -36,7 +38,7 @@ CMOS::Time& CMOS::Time::hw_update() {
3638 f.day_of_month = bcd_to_binary (get (r_day));
3739 f.month = bcd_to_binary (get (r_month));
3840 f.year = bcd_to_binary (get (r_year));
39- f.century = get (r_cent);
41+ f.century = bcd_to_binary ( get (r_cent) );
4042 }
4143
4244 // Convert to 24-hour clock if necessary
@@ -51,7 +53,7 @@ CMOS::Time& CMOS::Time::hw_update() {
5153std::string CMOS::Time::to_string (){
5254 std::array<char ,20 > str;
5355 sprintf (str.data (), " %.2i-%.2i-%iT%.2i:%.2i:%.2iZ" ,
54- ( f.century + 20 ) * 100 + f.year ,
56+ f.century * 100 + f.year ,
5557 f.month ,
5658 f.day_of_month ,
5759 f.hour , f.minute , f.second );
0 commit comments