4 ms·
Interesting thing about hardware real time clocks. They are usually as bad as the C time API. I worked with a guy that designed three RTC clock cards for an in
by Gibbon1 2y ago
Interesting thing about hardware real time clocks. They are usually as bad as the C time API.
I worked with a guy that designed three RTC clock cards for an industrial bus system
The first had registers for hours minutes, seconds, day, month, year. He was proud it handed the leap years correctly. It had a battery back up.
The second design just had a 48 bit counter that counted ticks. You could read and and write it using latches so the read/writes were atomic.
The third design was a read only 48 bit counter and a 1024 bit battery back ram.
In the second and third design the conversion from time to a string is done in software. In the third the clock just provides a free running timer and you store an offset in battery backed ram along with other time related meta data.
The vast majority of hardware RTC clocks today are implemented like the first example. It's a little infuriating since my coworker figured out how to do it right 45 years ago.
- immibis 2y agoIndeed, the first was obviously designed as "make a clock but digital" and the second was designed as "create a unique identifier for each instant" and the last was "also make it as stateless as possible"