Retrieving Date and Time From The Internet

Andre Garzia andre at andregarzia.com
Wed Aug 17 08:55:37 EDT 2011


Folks,

this thread made me curious...

I present to you a simple SNTP stack

go stack "http://andregarzia.com/stacks/libNTPToy.livecode"

It is a quick and dirty implementation with no error checking. It has one
function getTime(), you pass the NTP server and it returns the current date
and time in seconds format. I tried with our official Brazilian time servers
and it worked.

Hope this helps. By the way, I don't truly understand the NTP protocol, I
picked a couple ruby and python code and converted to livecode with the aid
of wireshark marvelous sniffer tool to see the damn datagrams flowing. (I
hate binary protocols)

=)

Cheers
andre



More information about the Use-livecode mailing list