We have a system with one display (with integrated hardware real time clock), and multiple controllers. What is the best way to keep a synchronized time in the other controllers when the display is off, but some of the other controllers are still running?
Consider that the display is sending the current date and time once a second when it is running.
How can the rest of the controllers (or at least one of them) keep the time when the messages from the display are stopped?
One thought was to just have separate counters for seconds, minutes, hours, days, months and years. With a one-second oscillator feeding the seconds counter, and the carry signal goes to the next counter. The problem is that that months have 28-31 days, and there are leap-years... So that will be complicated.
If there was possible to use the C or C++ functions for converting between a number of milliseconds since some epoch time and then back to a date, that would be simpler.
Someone have another idea? It is very useful for writing timestamped application logs in a machine when the machine is "off" but a least one controller is still running.