Hi Harold, thanks for the input. In the name of co-operative multitasking I considered it was an oversight. I will leave the code as. I am curious, rather than testing if your counter is drifting by more than 1 sec, why not just trust and stuff the NTP value. I do like the idea of fine adjustment of the 1 Hz interrupt. The 32 bit roll over has always been in the back of my mind and thinking this device will break in 2038 (or is it 2136) I am currently trying to determine why this is in the code. // Adjust for SNTP counter rollover and local tick counter // start time if ( TX_Timestamp.v[3] & 0x80 ) TX_Timestamp.Val -=3D 3155673600ul; else TX_Timestamp.Val +=3D 1139207298ul; Justin On 14 September 2015 at 11:12, Harold Hallikainen wrote: > The lack of a break in a state machine is often done on purpose. It is > used where we want to immediately execute the code for the next state > instead of exiting and coming back to execute it. I don't like using > state++ because it's too easy to lose track of where you're going to. I > like saying state=3DStateName and going on from there. > > In my use of the Microchip SNTP client, I have a 32 bit counter that is > incremented by a once per second interrupt. If the counter disagrees with > the result from SNTP by more than one second (I allow for plus/minus one > second jitter), I stuff the value returned by NTP into my counter. I also > save this value as LastNtp so I can see when the RTC was updated, if ever= .. > Generally, if it was ever updated, I consider the clock to be valid. Also= , > if I have to move my clock ahead, I adjust the 1 Hz interrupt period > register one count to make the interrupts happen faster. If I need to slo= w > the RTC down, I go the other way. > > I'm using the 32 bit time stamp value for all my internal usage and > converting to a string only for user interface. > > Does anyone have suggestions for handling the upcoming 32 bit rollover > with the Microchip code? Can we move to a 64 bit version of time_t? > > Harold > > > > > -- > FCC Rules Updated Daily at http://www.hallikainen.com - Advertising > opportunities available! > Not sent from an iPhone. > -- > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .