Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/22/08 09:50
Read: times


 
#149822 - Uptime and SyncTime - Comments Appreciated
Hi all - not sure if this is 8051 related (but I am implementing it on an 8051) so feel free to move this thread as appropriate.

I am developing on the Silabs C8051f040 with CAN, I have the CAN working fine.

as part of my application I am wanting to have a global time stamp for some of the events on the bus, ie all devices have a common timebase.


I also want to track the uptime of the device. - this is easy


struct uptime {
	unsigned int mSecs;
	unsigned char secs;
	unsigned char mins;
	unsigned char hours;
	unsigned int days;
}; 




The question really is, how do you keep track of a common time base across all devices?

My initial thoughts were that's easy, when a new device comes online simply have it broadcast a "reset your clock to 0" message and then all units are back in sync. While this works fine, it means that if I am storing times in a database (I haven't done this yet) then the times will appear to randomly reset back to 0 each time a new device is connected to the bus.

Alternatively, I could listen for devices coming online and have the first device online broadcast the current (or a current) time, that all devices then re-sync to. This to has issues, what if this device fails, who becomes time keeper?

How have any others approached this??

Thanks and regards

Marshall Brown




List of 6 messages in thread
TopicAuthorDate
Uptime and SyncTime - Comments Appreciated            01/01/70 00:00      
   what about a 'timekeeper'            01/01/70 00:00      
   Who needs the time?            01/01/70 00:00      
      the "System" requires the time            01/01/70 00:00      
         KISS            01/01/70 00:00      
            well that's a good point!            01/01/70 00:00      

Back to Subject List