That's just wrong. There are popular real time clock peripherals, but in the vast majority of cases microcontrollers can generate their own real time clock functions using one of their internal timers and a TINY bit of their overall processing time.In a microcontroller system this must be implemented as an external part. Not as a core CPU function. So the code for this part must be rewritten for every system implementing it.
...
// C code for a 1 second period with a 1MHz timer (4MHz xtal);
// uses 1 variable; unsigned long bres
// gets here every TMR0 int (every 256 ticks)
bres += 256; // add 256 ticks to bresenham total
if(bres >= 1000000) // if reached 1 second!
{
bres -= 1000000; // subtract 1 second, retain error
do_1sec_event(); // update clock, etc
}
secs++;
if(secs >= 60)
{
secs = 0;
mins++;
}
if(mins >= 60)
{
mins = 0;
hours++;
}
if(hours > 12) hours = 1;
No offence takenSorry to06afre, I didn't meant to sound picky at you.