NTP with Opto, sort of - old forum post

stevio

Joined on 05-02-2007
Posts 3
NTP with Opto (sort of…)

Hi
I recently looked into implementing some NTP code in a PAC-S1 controller, but after searching on the web found little info in helping me do this. You could also use the daytime protocol, but if you are locked down behind a firewall (which we are), you probably can’t open a session on port 13. But stumbled across a site which gave me a practable solution. The HTTP protocol stipulates that every page must contain a date/time stamp (or so this site said…). So after opening a telnet session to google.com I found that the date/time stamp delivered on the page was pretty damn close to my NTP updated time on my pc (being a giant like ‘google’ you’d think that their time and date would be pretty good…). So I wrote some code to open a session to google.com on port 80 and request the head data from their index.html page and dissect the returned data to extract the date and time. After adding some offsets for GMT the thing is pretty damn good (within a second). I know that you can sync your controller from the Opto Runtime, but what if you don’t have a runtime?? Anyway if anyone was looking to implement some sort of NTP code, I hope this info helps in providing some sort of solution.
Stevio
PS. If you want to check out the chart, send me an email: stevo@manorts.com