开发者

Delphi routine which retrieve the current time and date from a time server

开发者 https://www.devze.com 2022-12-19 17:25 出处:网络
I am looking for a Delphi 7 routine which c开发者_StackOverflowonnects to a time server to retrieve the correct time and date, and a routine to update the time and date of the pc.

I am looking for a Delphi 7 routine which c开发者_StackOverflowonnects 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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号