using IdDayTime to get time

Giganews Newsgroups
Subject: using IdDayTime to get time
Posted by:  David Edwards (dedwar…@athens.net)
Date: Tue, 15 Apr 2008

I tried to find an example of IdDayTime to get the time from an external
time server with no luck. (Delphi 2007)

I drop a TLabel and a TIdDayTime on a blank form and set its host to
time.windows.com and leave the port to 15 (I tried port 1 also, per net time
/querystnp).

In the Label1's OnClick, I have:

procedure TForm1.Label1Click(Sender: TObject);
begin
  IdDayTime1.ConnectAndGetAll;
  Label1.Caption:= IdDayTime1.DayTimeStr;
end;

When I click the label, after a minute or so, the program waits, and then I
get 10060 -- connection timed out.

Am I on the right track?  How can I increase the timeout wait period?

Is there a better way to get the time?

Thanks!

Replies