Grabbing the Date and Time From a Time Server on the Internet

Bob Sneidar bobs at twft.com
Mon Aug 15 20:04:42 EDT 2011


The Internet Date returns the date and time, along with the current time zone set in your preferences. If the user changes his date and time manually though, it will faithfully return whatever the user enters. Querying a time server on the internet will always return the real date and time. 

Suppose you had a trial scheme which expired the license after 30 days. The easiest way to defeat that would be to always set the clock back whenever you used the software. But that would be to no avail if you check the RealTime (as I named my function). 

Also, Windows Clients are sometimes configured to get the date and time from an internal time server running on the network. If that time server service stops functioning and the admin doesn't know it, the time can drift quite a bit aver several weeks. Any app that was critically dependent on knowing the exact time might not work correctly. 

Someone mentioned that if you were using sql, that you could query the sql server for the date and time. This actually has a real advantage over a time server, as NTP or even HTTP could be blocked by a personal firewall using ports or a blacklist, but no one could firewall off the sql server you need to run your application! 

Bob


On Aug 15, 2011, at 3:50 PM, Pete wrote:

> I missed the beginning of this thread so I'm probably missing the point
> here, but what's wrong with using the LC "internet date"?
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
> 
> 
> 
> 
> On Mon, Aug 15, 2011 at 3:19 PM, Bob Sneidar <bobs at twft.com> wrote:
> 
>> I may have sent you a version that was bugged. This is the final one I came
>> up with:
>> 
>> function realTime theFormat, useOffset
>>  if useOffset is empty then put false into useOffset
>>  put "http://tycho.usno.navy.mil/cgi-bin/timer.pl" into theURL
>>  get url theURL
>>  put it into theResult
>>  filter theResult with "<BR>*UTC*"
>>  replace "<BR>" with empty in theResult
>>  put word 1 to 3 of theResult into theResult
>>  if useOffset then
>>     put word -1 of theResult into theTime
>>     put word -1 of the internet date into theZoneOffset
>>     put theZoneOffset /100 into theZoneOffset
>>     set the itemdelimiter to ":"
>>     put (item 1 of theTime + theZoneOffset) into item 1 of theTime
>>     put theTime into word -1 of theResult
>>  end if
>> 
>>  if theFormat is "seconds" then
>>     put word -1 of theResult into theResult
>>     convert theResult to seconds
>>  end if
>> 
>>  return theResult
>> end realTime
>> 
>> Bob
>> 
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list