Author Topic: URL to supply the current time  (Read 1418 times)

jfedison741

  • Newbie
  • *
  • Posts: 13
URL to supply the current time
« on: January 31, 2010, 04:54:07 PM »
I am using the serial web services API and would like to use [[[get|url]]] to obtain accurate date and time information. I need resolution of seconds (getting the time from the ioBridge server only gives the time to the nearest minute).

Can anyone suggest a URL that gives the current time? Also, the URL needs to respond with fewer than 80 character to satisfy the limits of responses to [[[get|url]]].

Thanks.

zero*gx

  • Full Member
  • ***
  • Posts: 116
    • zero*gx
Re: URL to supply the current time
« Reply #1 on: January 31, 2010, 11:20:42 PM »
are you looking for local time or greenwich mean time?
zero*gx | imagineering solutions

jfedison741

  • Newbie
  • *
  • Posts: 13
Re: URL to supply the current time
« Reply #2 on: February 01, 2010, 09:46:24 AM »
GMT/UTC would be fine.

nick

  • Full Member
  • ***
  • Posts: 174
Re: URL to supply the current time
« Reply #3 on: February 01, 2010, 01:46:06 PM »
http://time-a.timefreq.bldrdoc.gov:13/

Works in my browser.  Haven't tried it with the web API.

It uses the DAYTIME protocol.  More info here: http://www.kloth.net/software/timesrv1.php

zero*gx

  • Full Member
  • ***
  • Posts: 116
    • zero*gx
Re: URL to supply the current time
« Reply #4 on: February 01, 2010, 07:12:36 PM »
The code for doing the time based on server time:
Code: [Select]

<html>
<head>
<?echo date('h:i A')?>
 </body>
 </html>


it will need a hosting environment with php enabled.
zero*gx | imagineering solutions

nick

  • Full Member
  • ***
  • Posts: 174
Re: URL to supply the current time
« Reply #5 on: February 01, 2010, 09:44:54 PM »
The code for doing the time based on server time:
Code: [Select]

<html>
<head>
<?echo date('h:i A')?>
 </body>
 </html>


That's another alternative.  You don't even have to include the HTML tags, I know the IOBridge will take straight text from a PHP page.

it will need a hosting environment with php enabled.

zero*gx

  • Full Member
  • ***
  • Posts: 116
    • zero*gx
Re: URL to supply the current time
« Reply #6 on: February 01, 2010, 10:18:44 PM »
Code: [Select]
<html>
<?echo date('h:i A')?>
 </html>

This is the minimum amount of code needed for keeping with web standards. you would be fine to strip the html. It's not the right way, but you will be fine to do so.
zero*gx | imagineering solutions

jfedison741

  • Newbie
  • *
  • Posts: 13
Re: URL to supply the current time
« Reply #7 on: February 03, 2010, 10:25:23 AM »
http://time-a.timefreq.bldrdoc.gov:13/

Works in my browser.  Haven't tried it with the web API.

It uses the DAYTIME protocol.  More info here: http://www.kloth.net/software/timesrv1.php

This works well. Be aware that occasionally the URL does not respond -- In 21 hours of [[[get|URL]]] at 2 minute intervals, I got 9 timeouts. I used a timeout interval of 3500 ms. In cases when the URL does not respond, I leave the timestamp blank and the API uses the current system time.

nick

  • Full Member
  • ***
  • Posts: 174
Re: URL to supply the current time
« Reply #8 on: February 03, 2010, 01:23:22 PM »
If you go to the link they list a whole bunch of other DAYTIME servers, probably one of them is more reliable.  Just make sure to put the ":13" at the end of the URL.

http://time-a.timefreq.bldrdoc.gov:13/

Works in my browser.  Haven't tried it with the web API.

It uses the DAYTIME protocol.  More info here: http://www.kloth.net/software/timesrv1.php

This works well. Be aware that occasionally the URL does not respond -- In 21 hours of [[[get|URL]]] at 2 minute intervals, I got 9 timeouts. I used a timeout interval of 3500 ms. In cases when the URL does not respond, I leave the timestamp blank and the API uses the current system time.