comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Get time and date from a server using a socket
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Get time and date from a server using a socket [message #65331] Fri, 27 February 2009 08:34 Go to previous message
Allan Whiteford is currently offline  Allan Whiteford
Messages: 117
Registered: June 2006
Senior Member
bernat wrote:
> Lool !
>
> Thank you Allan... It works for me too.
> I never expected that it's required to read 2 time on the port.
>
> Thank you !
>
> Bernat

Bernat,

It only seems to be the NIST timeservers which add this extra line. I
don't know why though.

If I start a daytime server on my local machine I get this:

[allan@hostname ~]$ telnet localhost 13
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
27 FEB 2009 16:25:04 GMT
Connection closed by foreign host.
[allan@hostname ~]$

whereas the NIST server gives me:

[allan@hostname ~]$ telnet time-a.nist.gov 13
Trying 129.6.15.28...
Connected to time-a.nist.gov.
Escape character is '^]'.

54889 09-02-27 16:26:16 00 0 0 230.6 UTC(NIST) *
Connection closed by foreign host.
[allan@hostname ~]$

where the blank line has been sent back by NIST.

A glance over the RFC (http://www.faqs.org/rfcs/rfc867.html) suggests
that there isn't a particular format for what comes back so I don't
think you should try to parse it. It also suggets that the whole thing
should be on one line but doesn't explicitly say anything about whether
a blank line is allowable first. The recommendation is that if you want
something machine readable you should use port 37 (RFC868).

However, I don't think it's ever safe to ask for the time over TCP/IP
due to possible time-lag in the response (that's why NTP runs over UDP).
My opinion is still that you should just have the local time set
accurately using NTP and only ever ask your local machine for the time
from within IDL.

Thanks,

Allan
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Fractions in IDL
Next Topic: Get time and date from a server using a socket

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 04:22:19 PDT 2025

Total time taken to generate the page: 1.92048 seconds