Retrieving Date and Time From The Internet

Scott Rossi scott at tactilemedia.com
Tue Aug 16 16:36:41 EDT 2011


Recently, Bob Sneidar wrote:

> Until someone can come up with an HTTP link that returns the year with the
> date and time, or else Livecode supports NTP queries, we are SOL. I have
> searched high and low and cannot find one single web site besides
> http://tycho.usno.navy.mil/cgi-bin/timer.pl that returns anything usable.
> Leave it up to a sailor to get you most of the way there, and then let you
> swim the rest of the way! LOL! (I'm an ex-sailor so I can say that).

A fun challenge.  Here's one option, limited to a single time (US Eastern),
with no guarantee of reliability (can any Web-based service truly claim
this?):

function timeStamp
   put url "http://www.atomictime.net/front.html" into temp
   wait 500 millisecs with messages
   put url "http://www.atomictime.net/time_tel.html?2" into temp
   repeat with N = number of lines of temp down to 1
      if line N of temp is not empty then return line N of temp
   end repeat
end timeStamp

The reason for the dual URLs is the host requires initial access through a
home page.  Only thing I can guess is there's some back-end foolery going on
that's not accessible (at least I can't see anything that's apparent, but
maybe that's just me).

I tried setting my system clock back 2 hours and the page continues to
return the current Eastern time, so the service *appears* to be legit.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design






More information about the Use-livecode mailing list