views:

475

answers:

2

I am looking for a Delphi 7 routine which connects to a time server to retrieve the correct time and date, and a routine to update the time and date of the pc.

The routine should of course take into account the time zone the pc is using.

If possible using the ICS component suite from Overbyte (because I use this set of free components for html and ftp access already). But if not, any solution would be appreciated.

Thanks in advance.

+1  A: 

You might want to google for "Delphi 7 NTP" or "Delphi 7 Network Time Protocol". Also, there must be tons of free components out there that you can use for free.

Thorsten Dittmar
Tried Googling but of course asked the wrong question obviously. Thx.
Edelcom
+5  A: 

Take a look at Indy's IdDayTime component. Point it to your favourite time server and check the DayTimeStr property.

  IdDayTime1.Host := 'time-a.nist.gov';
  Label1.Caption := IdDayTime1.DayTimeStr;

Edit: The result is in UTC time, so you'll probably need to convert it.

Bruce McGee
+1 - Right, I forgot about the Indy components. My Delphi-days are long gone...
Thorsten Dittmar