Does anyone have any code that turns NTP returned packets into date & time that can be used to set the date & time in Zbasic ?
It's described here https://www.eecis.udel.edu/~mills/time.html
I daresay i can work out how to do it, but not into reinventing if someone has some proven code ?
thanks
Decoding NTP packet
Re: Decoding NTP packet
The code that accompanies AN-224 includes a UDP client that has such an NTP converter. In the project NetTime.bas the Main() routine calls a function GetTimeNTP() that does all of the UDP work and returns a value from the server representing seconds since 01 Jan 1900 0:00:00. That value is then manipulated to produce the ZBasic day number and RTC tick values to set the RTC.FFMan wrote:Does anyone have any code that turns NTP returned packets into date & time that can be used to set the date & time in Zbasic ?
So, the extraction of the data from the UDP packet is found in GetTimeNTP() and the setting of the RTC is in Main().
- Don Kinzer