Re: Grabbing the Date and Time From a Time Server on the Internet
I too am scratching my head on that one, Bob. Gregory On Tue, Aug 16, 2011, at 6:46 PM, use-livecode-requ...@lists.runrev.com wrote: Message: 2 Date: Tue, 16 Aug 2011 10:31:13 -0700 From: Bob Sneidar b...@twft.com To: How to use LiveCode use-livecode@lists.runrev.com Subject: Re: Grabbing the Date and Time From a Time Server on the Internet Message-ID: 5f787920-e6f0-41c4-b793-3f1b14e60...@twft.com Content-Type: text/plain; charset=windows-1252 I see the problem here. The url I use does not return the year! And I cannot just get the year from the system date, because that defeats the whole purpose of a RealTime function. Going to have to do a bit more research. Bob On Aug 16, 2011, at 9:33 AM, Gregory Lypny wrote: Hi Bob, Good summary, Bob. It summarizes nicely the issues that I?m dealing with in creating a client-side student helper app. Your RealTime function works nicely. The only thing missing is the year, which again, is something that a user could set manually. Regards, Gregory ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
Folks, See the other thread... I created a simple NTP stack... go stack url http://andregarzia.com/stacks/libNTPToy.livecode; ;-) It is a silly implementation, really naive but it works... On Wed, Aug 17, 2011 at 9:51 AM, Gregory Lypny gregory.ly...@videotron.cawrote: I too am scratching my head on that one, Bob. Gregory On Tue, Aug 16, 2011, at 6:46 PM, use-livecode-request@lists.runrev.comwrote: Message: 2 Date: Tue, 16 Aug 2011 10:31:13 -0700 From: Bob Sneidar b...@twft.com To: How to use LiveCode use-livecode@lists.runrev.com Subject: Re: Grabbing the Date and Time From a Time Server on the Internet Message-ID: 5f787920-e6f0-41c4-b793-3f1b14e60...@twft.com Content-Type: text/plain; charset=windows-1252 I see the problem here. The url I use does not return the year! And I cannot just get the year from the system date, because that defeats the whole purpose of a RealTime function. Going to have to do a bit more research. Bob On Aug 16, 2011, at 9:33 AM, Gregory Lypny wrote: Hi Bob, Good summary, Bob. It summarizes nicely the issues that I?m dealing with in creating a client-side student helper app. Your RealTime function works nicely. The only thing missing is the year, which again, is something that a user could set manually. Regards, Gregory ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- http://www.andregarzia.com All We Do Is Code. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
Hi Bob, Good summary, Bob. It summarizes nicely the issues that I’m dealing with in creating a client-side student helper app. Your RealTime function works nicely. The only thing missing is the year, which again, is something that a user could set manually. Regards, Gregory On Tue, Aug 16, 2011, at 11:44 AM, use-livecode-requ...@lists.runrev.com wrote: Message: 1 Date: Mon, 15 Aug 2011 17:04:42 -0700 From: Bob Sneidar b...@twft.com To: How to use LiveCode use-livecode@lists.runrev.com Subject: Re: Grabbing the Date and Time From a Time Server on the Internet Message-ID: 71dfe006-b408-43b4-8cec-ab4f1fe20...@twft.com Content-Type: text/plain; charset=us-ascii 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 ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
I see the problem here. The url I use does not return the year! And I cannot just get the year from the system date, because that defeats the whole purpose of a RealTime function. Going to have to do a bit more research. Bob On Aug 16, 2011, at 9:33 AM, Gregory Lypny wrote: Hi Bob, Good summary, Bob. It summarizes nicely the issues that I’m dealing with in creating a client-side student helper app. Your RealTime function works nicely. The only thing missing is the year, which again, is something that a user could set manually. Regards, Gregory ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
This returns a ton of html, from which the date time can be filtered using H2*, but since it takes about 30 seconds to run, and returns 32 entries, I am not sure how useful this would for him, if he wanted an exact time (within a second or two). Time servers are NTP:\\ aren't they? Looks like the revURL library does not support NTP, or not that I can see. Any attempt to use it in a URL returns empty in it and invalid URL: in the result. A quick browse for http based time servers came up dry. Bob On Aug 13, 2011, at 11:15 AM, Mark Wieder wrote: Gregory- Saturday, August 13, 2011, 10:33:29 AM, you wrote: Taking another kick at the cat here. Id like to use something like get url (http://[time server address]) How's this? http://tycho.usno.navy.mil/cgi-bin/anim -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
Bob, I don't see a ton of html at http://tycho.usno.navy.mil/cgi-bin/timer.pl It's just about as simple as it could be presented. It took just a few lines of Livecode to scrape. Determine AM and PM and one could even translate to 24 hour clock. There's about a half second of latency. I just see this html: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 3.2 Final//EN html body TITLEWhat time is it?/TITLE H2 US Naval Observatory Master Clock Time/H2 H3PRE BRAug. 15, 18:52:50 UTC Universal Time BRAug. 15, 02:52:50 PM EDTEastern Time BRAug. 15, 01:52:50 PM CDTCentral Time BRAug. 15, 12:52:50 PM MDTMountain Time BRAug. 15, 11:52:50 AM PDTPacific Time BRAug. 15, 10:52:50 AM AKDT Alaska Time BRAug. 15, 08:52:50 AM HAST Hawaii-Aleutian Time /PRE/H3PA HREF=http://www.usno.navy.mil; US Naval Observatory/A /body/html On 15 August 2011 10:25, Bob Sneidar b...@twft.com wrote: This returns a ton of html, from which the date time can be filtered using H2*, but since it takes about 30 seconds to run, and returns 32 entries, I am not sure how useful this would for him, if he wanted an exact time (within a second or two). Time servers are NTP:\\ aren't they? Looks like the revURL library does not support NTP, or not that I can see. Any attempt to use it in a URL returns empty in it and invalid URL: in the result. A quick browse for http based time servers came up dry. Bob On Aug 13, 2011, at 11:15 AM, Mark Wieder wrote: Gregory- Saturday, August 13, 2011, 10:33:29 AM, you wrote: Taking another kick at the cat here. I’d like to use something like get url (http://[time server address]) How's this? http://tycho.usno.navy.mil/cgi-bin/anim -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- Stephen Barncard San Francisco Ca. USA more about sqb http://www.google.com/profiles/sbarncar ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
it's UDP. One could use sockets in Livecode. Probably pretty easy to make a Time Server LIb here's the poop from the time peoplehttp://www.nist.gov/pml/div688/grp40/its.cfm http://www.nist.gov/pml/div688/grp40/its.cfm On 15 August 2011 11:57, stephen barncard stephenrevoluti...@barncard.comwrote: Bob, I don't see a ton of html at http://tycho.usno.navy.mil/cgi-bin/timer.pl It's just about as simple as it could be presented. It took just a few lines of Livecode to scrape. Determine AM and PM and one could even translate to 24 hour clock. There's about a half second of latency. I just see this html: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 3.2 Final//EN html body TITLEWhat time is it?/TITLE H2 US Naval Observatory Master Clock Time/H2 H3PRE BRAug. 15, 18:52:50 UTC Universal Time BRAug. 15, 02:52:50 PM EDT Eastern Time BRAug. 15, 01:52:50 PM CDT Central Time BRAug. 15, 12:52:50 PM MDT Mountain Time BRAug. 15, 11:52:50 AM PDT Pacific Time BRAug. 15, 10:52:50 AM AKDT Alaska Time BRAug. 15, 08:52:50 AM HAST Hawaii-Aleutian Time /PRE/H3PA HREF=http://www.usno.navy.mil; US Naval Observatory/A /body/html On 15 August 2011 10:25, Bob Sneidar b...@twft.com wrote: This returns a ton of html, from which the date time can be filtered using H2*, but since it takes about 30 seconds to run, and returns 32 entries, I am not sure how useful this would for him, if he wanted an exact time (within a second or two). Time servers are NTP:\\ aren't they? Looks like the revURL library does not support NTP, or not that I can see. Any attempt to use it in a URL returns empty in it and invalid URL: in the result. A quick browse for http based time servers came up dry. Bob On Aug 13, 2011, at 11:15 AM, Mark Wieder wrote: Gregory- Saturday, August 13, 2011, 10:33:29 AM, you wrote: Taking another kick at the cat here. I’d like to use something like get url (http://[time server address]) How's this? http://tycho.usno.navy.mil/cgi-bin/anim -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- Stephen Barncard San Francisco Ca. USA more about sqb http://www.google.com/profiles/sbarncar -- Stephen Barncard San Francisco Ca. USA more about sqb http://www.google.com/profiles/sbarncar ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
I'll try sending this again, revised (third time -- someone let me know please if it's getting through). It returns the time fast enough (with a speedy connection) to be within a second or so. -- You can fetch the time from the U.S. Naval Observatory atomic clock. This assumes an internet connection, though. If what you want to do is timestamp something, just fetch the universal time line (line 6 of the HTML returned): function fetchTime put line 6 of URL http://tycho.usno.navy.mil/cgi-bin/timer.pl; into t -- returns BRAug. 15, 19:12:46 UTC tab tab Universal Time replace BR with empty in t set the itemdelimiter to tab delete item 2 to -1 of t set the itemdelimiter to comma delete word -1 of t put t into ts put the short date into di convert di to dateitems put item 1 of di into tYr put space tYr after item 1 of t put space tYr after item 1 of ts replace comma with empty in t replace comma with empty in ts convert ts to seconds put t cr ts return t -- if you want Aug. 15, 19:12:46or, return ts -- if you want the seconds end fetchTime -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Aug 15, 2011, at 1:25 PM, Bob Sneidar wrote: This returns a ton of html, from which the date time can be filtered using H2*, but since it takes about 30 seconds to run, and returns 32 entries, I am not sure how useful this would for him, if he wanted an exact time (within a second or two). Time servers are NTP:\\ aren't they? Looks like the revURL library does not support NTP, or not that I can see. Any attempt to use it in a URL returns empty in it and invalid URL: in the result. A quick browse for http based time servers came up dry. Bob On Aug 13, 2011, at 11:15 AM, Mark Wieder wrote: Gregory- Saturday, August 13, 2011, 10:33:29 AM, you wrote: Taking another kick at the cat here. I’d like to use something like get url (http://[time server address]) How's this? http://tycho.usno.navy.mil/cgi-bin/anim -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
Oh hey there you go! But that was not the URL originally posted. Bob On Aug 15, 2011, at 11:57 AM, stephen barncard wrote: Bob, I don't see a ton of html at http://tycho.usno.navy.mil/cgi-bin/timer.pl It's just about as simple as it could be presented. It took just a few lines of Livecode to scrape. Determine AM and PM and one could even translate to 24 hour clock. There's about a half second of latency. I just see this html: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 3.2 Final//EN html body TITLEWhat time is it?/TITLE H2 US Naval Observatory Master Clock Time/H2 H3PRE BRAug. 15, 18:52:50 UTC Universal Time BRAug. 15, 02:52:50 PM EDT Eastern Time BRAug. 15, 01:52:50 PM CDT Central Time BRAug. 15, 12:52:50 PM MDT Mountain Time BRAug. 15, 11:52:50 AM PDT Pacific Time BRAug. 15, 10:52:50 AM AKDT Alaska Time BRAug. 15, 08:52:50 AM HAST Hawaii-Aleutian Time /PRE/H3PA HREF=http://www.usno.navy.mil; US Naval Observatory/A /body/html On 15 August 2011 10:25, Bob Sneidar b...@twft.com wrote: This returns a ton of html, from which the date time can be filtered using H2*, but since it takes about 30 seconds to run, and returns 32 entries, I am not sure how useful this would for him, if he wanted an exact time (within a second or two). Time servers are NTP:\\ aren't they? Looks like the revURL library does not support NTP, or not that I can see. Any attempt to use it in a URL returns empty in it and invalid URL: in the result. A quick browse for http based time servers came up dry. Bob On Aug 13, 2011, at 11:15 AM, Mark Wieder wrote: Gregory- Saturday, August 13, 2011, 10:33:29 AM, you wrote: Taking another kick at the cat here. I’d like to use something like get url (http://[time server address]) How's this? http://tycho.usno.navy.mil/cgi-bin/anim -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- Stephen Barncard San Francisco Ca. USA more about sqb http://www.google.com/profiles/sbarncar ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
Looks like only the time zones applicable to the US, however a simple table of time zones and their +/- relation to Universal Time could easily make this into a capable International Time function, once you knew the user's current time zone. This interests me, because while I *could* depend on the system time I suppose, to datetimestamp entries in an SQL table, the user could simply change the system time and date manually to defeat what I was trying to do. Using Universal time gotten just before the update or insert statement would prevent tampering. Bob On Aug 15, 2011, at 11:57 AM, stephen barncard wrote: Bob, I don't see a ton of html at http://tycho.usno.navy.mil/cgi-bin/timer.pl It's just about as simple as it could be presented. It took just a few lines of Livecode to scrape. Determine AM and PM and one could even translate to 24 hour clock. There's about a half second of latency. I just see this html: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 3.2 Final//EN html body TITLEWhat time is it?/TITLE H2 US Naval Observatory Master Clock Time/H2 H3PRE BRAug. 15, 18:52:50 UTC Universal Time BRAug. 15, 02:52:50 PM EDT Eastern Time BRAug. 15, 01:52:50 PM CDT Central Time BRAug. 15, 12:52:50 PM MDT Mountain Time BRAug. 15, 11:52:50 AM PDT Pacific Time BRAug. 15, 10:52:50 AM AKDT Alaska Time BRAug. 15, 08:52:50 AM HAST Hawaii-Aleutian Time /PRE/H3PA HREF=http://www.usno.navy.mil; US Naval Observatory/A /body/html ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
Beat me to the punch! Bob On Aug 15, 2011, at 12:15 PM, Peter M. Brigham, MD wrote: I'll try sending this again, revised (third time -- someone let me know please if it's getting through). It returns the time fast enough (with a speedy connection) to be within a second or so. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
Maybe a little more concise: function realTime theFormat breakpoint 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 theFormat is seconds then put word -1 of theResult into theResult convert theResult to seconds end if -- add more conversions here return theResult end realTime On Aug 15, 2011, at 12:15 PM, Peter M. Brigham, MD wrote: I'll try sending this again, revised (third time -- someone let me know please if it's getting through). It returns the time fast enough (with a speedy connection) to be within a second or so. -- You can fetch the time from the U.S. Naval Observatory atomic clock. This assumes an internet connection, though. If what you want to do is timestamp something, just fetch the universal time line (line 6 of the HTML returned): function fetchTime put line 6 of URL http://tycho.usno.navy.mil/cgi-bin/timer.pl; into t -- returns BRAug. 15, 19:12:46 UTC tab tab Universal Time replace BR with empty in t set the itemdelimiter to tab delete item 2 to -1 of t set the itemdelimiter to comma delete word -1 of t put t into ts put the short date into di convert di to dateitems put item 1 of di into tYr put space tYr after item 1 of t put space tYr after item 1 of ts replace comma with empty in t replace comma with empty in ts convert ts to seconds put t cr ts return t -- if you want Aug. 15, 19:12:46or, return ts -- if you want the seconds end fetchTime -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Aug 15, 2011, at 1:25 PM, Bob Sneidar wrote: This returns a ton of html, from which the date time can be filtered using H2*, but since it takes about 30 seconds to run, and returns 32 entries, I am not sure how useful this would for him, if he wanted an exact time (within a second or two). Time servers are NTP:\\ aren't they? Looks like the revURL library does not support NTP, or not that I can see. Any attempt to use it in a URL returns empty in it and invalid URL: in the result. A quick browse for http based time servers came up dry. Bob On Aug 13, 2011, at 11:15 AM, Mark Wieder wrote: Gregory- Saturday, August 13, 2011, 10:33:29 AM, you wrote: Taking another kick at the cat here. I’d like to use something like get url (http://[time server address]) How's this? http://tycho.usno.navy.mil/cgi-bin/anim -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
On Monday, August 15, 2011 12:31:25 PM Bob Sneidar wrote: This interests me, because while I could depend on the system time I suppose, to datetimestamp entries in an SQL tab But wouldn't it be simpler, and smarter, to let the db create and store store its own timestamp as the insert is made? Input from the user would be unnecessary and even irrelevant. http://dev.mysql.com/doc/refman/5.0/en/timestamp.html Warren ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
I suppose I could do that and then do a conversion coming and going. Bob On Aug 15, 2011, at 1:46 PM, Warren Samples wrote: On Monday, August 15, 2011 12:31:25 PM Bob Sneidar wrote: This interests me, because while I could depend on the system time I suppose, to datetimestamp entries in an SQL tab But wouldn't it be simpler, and smarter, to let the db create and store store its own timestamp as the insert is made? Input from the user would be unnecessary and even irrelevant. http://dev.mysql.com/doc/refman/5.0/en/timestamp.html Warren ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
Thanks for this, Bob. I did some more poking around myself and this seems to work. Not too difficult remove the HTML. on mouseUp put url (http://tycho.usno.navy.mil/cgi-bin/timer.pl;) end mouseUp On Mon, Aug 15, 2011, at 3:45 PM, use-livecode-requ...@lists.runrev.com wrote: Message: 3 Date: Mon, 15 Aug 2011 10:25:06 -0700 From: Bob Sneidar b...@twft.com To: How to use LiveCode use-livecode@lists.runrev.com Subject: Re: Grabbing the Date and Time From a Time Server on the Internet Message-ID: 5ec0da15-9be3-41d9-b047-250e2733c...@twft.com Content-Type: text/plain; charset=iso-8859-1 This returns a ton of html, from which the date time can be filtered using H2*, but since it takes about 30 seconds to run, and returns 32 entries, I am not sure how useful this would for him, if he wanted an exact time (within a second or two). Time servers are NTP:\\ aren't they? Looks like the revURL library does not support NTP, or not that I can see. Any attempt to use it in a URL returns empty in it and invalid URL: in the result. A quick browse for http based time servers came up dry. Bob ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
Thanks Stephen, I too came across this one today. Looks pretty easy to parse. Gregory On Mon, Aug 15, 2011, at 3:45 PM, use-livecode-requ...@lists.runrev.com wrote: Message: 14 Date: Mon, 15 Aug 2011 11:57:24 -0700 From: stephen barncard stephenrevoluti...@barncard.com To: How to use LiveCode use-livecode@lists.runrev.com Subject: Re: Grabbing the Date and Time From a Time Server on the Internet Message-ID: CAFmQfH+BdsdJb3Dmzz3TbmTm=ete4mdrxjyykx3w0xug0bx...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 Bob, I don't see a ton of html at http://tycho.usno.navy.mil/cgi-bin/timer.pl It's just about as simple as it could be presented. It took just a few lines of Livecode to scrape. Determine AM and PM and one could even translate to 24 hour clock. There's about a half second of latency. I just see this html: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 3.2 Final//EN html body TITLEWhat time is it?/TITLE H2 US Naval Observatory Master Clock Time/H2 H3PRE BRAug. 15, 18:52:50 UTC Universal Time BRAug. 15, 02:52:50 PM EDT Eastern Time BRAug. 15, 01:52:50 PM CDT Central Time BRAug. 15, 12:52:50 PM MDT Mountain Time BRAug. 15, 11:52:50 AM PDT Pacific Time BRAug. 15, 10:52:50 AM AKDT Alaska Time BRAug. 15, 08:52:50 AM HAST Hawaii-Aleutian Time /PRE/H3PA HREF=http://www.usno.navy.mil; US Naval Observatory/A /body/html ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
In my testing, the convert command fails with the date as given by the webpage, because the date lacks the year. Hence the need to insert the year first. And there needs to be no comma in the date. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Aug 15, 2011, at 3:54 PM, Bob Sneidar wrote: Maybe a little more concise: function realTime theFormat breakpoint 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 theFormat is seconds then put word -1 of theResult into theResult convert theResult to seconds end if -- add more conversions here return theResult end realTime On Aug 15, 2011, at 12:15 PM, Peter M. Brigham, MD wrote: I'll try sending this again, revised (third time -- someone let me know please if it's getting through). It returns the time fast enough (with a speedy connection) to be within a second or so. -- You can fetch the time from the U.S. Naval Observatory atomic clock. This assumes an internet connection, though. If what you want to do is timestamp something, just fetch the universal time line (line 6 of the HTML returned): function fetchTime put line 6 of URL http://tycho.usno.navy.mil/cgi-bin/timer.pl; into t -- returns BRAug. 15, 19:12:46 UTC tab tab Universal Time replace BR with empty in t set the itemdelimiter to tab delete item 2 to -1 of t set the itemdelimiter to comma delete word -1 of t put t into ts put the short date into di convert di to dateitems put item 1 of di into tYr put space tYr after item 1 of t put space tYr after item 1 of ts replace comma with empty in t replace comma with empty in ts convert ts to seconds put t cr ts return t -- if you want Aug. 15, 19:12:46or, return ts -- if you want the seconds end fetchTime -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Aug 15, 2011, at 1:25 PM, Bob Sneidar wrote: This returns a ton of html, from which the date time can be filtered using H2*, but since it takes about 30 seconds to run, and returns 32 entries, I am not sure how useful this would for him, if he wanted an exact time (within a second or two). Time servers are NTP:\\ aren't they? Looks like the revURL library does not support NTP, or not that I can see. Any attempt to use it in a URL returns empty in it and invalid URL: in the result. A quick browse for http based time servers came up dry. Bob On Aug 13, 2011, at 11:15 AM, Mark Wieder wrote: Gregory- Saturday, August 13, 2011, 10:33:29 AM, you wrote: Taking another kick at the cat here. I’d like to use something like get url (http://[time server address]) How's this? http://tycho.usno.navy.mil/cgi-bin/anim -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
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 On Aug 15, 2011, at 3:06 PM, Peter M. Brigham, MD wrote: In my testing, the convert command fails with the date as given by the webpage, because the date lacks the year. Hence the need to insert the year first. And there needs to be no comma in the date. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Aug 15, 2011, at 3:54 PM, Bob Sneidar wrote: Maybe a little more concise: function realTime theFormat breakpoint 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 theFormat is seconds then put word -1 of theResult into theResult convert theResult to seconds end if -- add more conversions here return theResult end realTime On Aug 15, 2011, at 12:15 PM, Peter M. Brigham, MD wrote: I'll try sending this again, revised (third time -- someone let me know please if it's getting through). It returns the time fast enough (with a speedy connection) to be within a second or so. -- You can fetch the time from the U.S. Naval Observatory atomic clock. This assumes an internet connection, though. If what you want to do is timestamp something, just fetch the universal time line (line 6 of the HTML returned): function fetchTime put line 6 of URL http://tycho.usno.navy.mil/cgi-bin/timer.pl; into t -- returns BRAug. 15, 19:12:46 UTC tab tab Universal Time replace BR with empty in t set the itemdelimiter to tab delete item 2 to -1 of t set the itemdelimiter to comma delete word -1 of t put t into ts put the short date into di convert di to dateitems put item 1 of di into tYr put space tYr after item 1 of t put space tYr after item 1 of ts replace comma with empty in t replace comma with empty in ts convert ts to seconds put t cr ts return t -- if you want Aug. 15, 19:12:46or, return ts -- if you want the seconds end fetchTime -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Aug 15, 2011, at 1:25 PM, Bob Sneidar wrote: This returns a ton of html, from which the date time can be filtered using H2*, but since it takes about 30 seconds to run, and returns 32 entries, I am not sure how useful this would for him, if he wanted an exact time (within a second or two). Time servers are NTP:\\ aren't they? Looks like the revURL library does not support NTP, or not that I can see. Any attempt to use it in a URL returns empty in it and invalid URL: in the result. A quick browse for http based time servers came up dry. Bob On Aug 13, 2011, at 11:15 AM, Mark Wieder wrote: Gregory- Saturday, August 13, 2011, 10:33:29 AM, you wrote: Taking another kick at the cat here. I’d like to use something like get url (http://[time server address]) How's this? http://tycho.usno.navy.mil/cgi-bin/anim -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
Re: Grabbing the Date and Time From a Time Server on the Internet
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 b...@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@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
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 b...@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@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
Ah, so the internet date is not really the internet date at all it's just whatever the computer's current date is in internet format. Interesting, didn't know that. Pete Molly's Revenge http://www.mollysrevenge.com On Mon, Aug 15, 2011 at 5:04 PM, Bob Sneidar b...@twft.com wrote: 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 b...@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@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
Gregory- Saturday, August 13, 2011, 10:33:29 AM, you wrote: Taking another kick at the cat here. Id like to use something like get url (http://[time server address]) How's this? http://tycho.usno.navy.mil/cgi-bin/anim -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
On Aug 13, 2011, at 1:33 PM, Gregory Lypny wrote: Taking another kick at the cat here. I’d like to use something like get url (http://[time server address]) to grab the current date and time from an official time server. This would be used in a LiveCode standalone distributed to collaborators and grad students who would use it to export time-sensitive data. I want the data to be date- and time-stamped, and I cannot count on their computer clocks being accurate. I suppose an alternative would be to get the creation date and time of the file once it is received via FTP (or better still, SFTP) use the the server date and time as the standard. Anyone? Please? I sent this message a couple days ago, apparently it never went through. (Parenthetically, even though I've set my preferences on the use-Livecode mailing list webpage to Receive your own posts to the list = yes, I never see any of my own postings.) -- You can fetch the time from the U.S. Naval Observatory atomic clock. This assumes an internet connection, though. In my little stack, the time zone is chosen by the user, so I fetch it from a customprop. You'll have to calculate the time offset from the last word of the internet date on the user machine -- I'll leave that to you. You need to convert something like -0400 [EDT] to 1, -0500 to 2 etc. but in winter the internet date will return -0500 for eastern *standard* time so you'll have to correct for that. The object is to get the correct line of the HTMLtext of the tycho webpage. Check out the format of the page, it's simple HTMLtext. This will give you a start: function fetchTime put URL http://tycho.usno.navy.mil/cgi-bin/timer.pl; into t -- gives a list of current times for all US time zones put the timeZone of stack TimeHelp into h -- time zone is as follows -- daylight time is given if currently applicable -- 1 = eastern -- 2 = central -- 3 = mountain -- 4 = pacific -- 5 = alaska -- 6 = hawaii put line 6+h of t into tTime delete item 1 of tTime return tTime end fetchTime -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
Peter- Saturday, August 13, 2011, 2:03:05 PM, you wrote: I sent this message a couple days ago, apparently it never went through. (Parenthetically, even though I've set my preferences on the use-Livecode mailing list webpage to Receive your own posts to the list = yes, I never see any of my own postings.) That's the way gmail works. It's not an option you can change. If you really need to see your own postings you can do one of two things: check one of the online archives (gmane, nabble...) or set the list to digest mode. -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
you can see your own posts in 'ALL MAIL' and move the ones that matter to the inbox. Also once part of a thread, it will show up. On 13 August 2011 16:33, Mark Wieder mwie...@ahsoftware.net wrote: Peter- Saturday, August 13, 2011, 2:03:05 PM, you wrote: I sent this message a couple days ago, apparently it never went through. (Parenthetically, even though I've set my preferences on the use-Livecode mailing list webpage to Receive your own posts to the list = yes, I never see any of my own postings.) That's the way gmail works. It's not an option you can change. If you really need to see your own postings you can do one of two things: check one of the online archives (gmane, nabble...) or set the list to digest mode. -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- Stephen Barncard San Francisco Ca. USA more about sqb http://www.google.com/profiles/sbarncar ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Grabbing the Date and Time From a Time Server on the Internet
On Aug 13, 2011, at 8:22 PM, stephen barncard wrote: you can see your own posts in 'ALL MAIL' and move the ones that matter to the inbox. Also once part of a thread, it will show up. That would be fine if I were using gmail via the browser, but I have my Mac Mail client set to fetch mail from my gmail inbox, along with the other inboxes from my other email addresses so I can read all my mail in one place. I gather that it's a problem with gmail filtering out the stuff I send to the use-LC list and it never gets downloaded to my Mac Mail. No way around that one, short of double checking via the browser, I guess. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode