then it should be pretty straightforward!
Code: Select all
{
outb(0x70,0);
seconds=inb(0x71);
outb(0x70,2);
minutes = inb(0x71);
...
char dayofweek[8]={"?","Sun","Mon", ... , "Sat"};
printf("%s %2x/%2x/%2x %2x:%2x %2x",dayofweek[day],
day,month,year,hour,minute,seconds);
}
of course, this expects you have a printf (or kprint or whatever) that can handle hexa display. As BCD is storing each digit on a separate nybble (i.e. bcd = hi-digit*16 + lo-digit), displaying it as an HEX will show the correct value.
Note that the above code only "prints" the current system time ... if you want other operations like comparing it, or keeping it up to date, you should do it yourself ...