如何从internet服务器上校对时间: WinXP下,双击任务栏右下角的系统时间,
出来一个“日期和时间 属性”设置窗口。
选择“internet 时间”。
在这里可能设置系统时间与internet服务器时间同步。
可以根据internet服务器更正系统时间。
还可以选择服务器(如可以选择香港天文台的服务器)。请问这如何用delphi程序实现。
出来一个“日期和时间 属性”设置窗口。
选择“internet 时间”。
在这里可能设置系统时间与internet服务器时间同步。
可以根据internet服务器更正系统时间。
还可以选择服务器(如可以选择香港天文台的服务器)。请问这如何用delphi程序实现。
软件当然有了,比如cool clock。
但,我们作为程序设计者,我们想知道实现方法。我也想知实现代码。up
var
NMDayTime1: TNMDayTime;
currentTime:TSystemTime;
i:integer;
str:String;
begin
NMDayTime1:=TNMDayTime.Create(self);
NMDayTime1.Host:='202.109.114.209';
NMDayTime1.Port:=13;
Label1.Caption:=NMDayTime1.DayTimeStr;
Edit1.Text:=Label1.Caption;
str:=copy(Label1.Caption,0,8);
DecodeTime(StrToTime(str),CurrentTime.wHour,CurrentTime.wMinute,
CurrentTime.wSecond,CurrentTime.wMilliseconds);
str:=copy(Label1.Caption,10,Length(Label1.Caption)-7);
DecodeDate(StrToDate(trim(str)),CurrentTime.wYear,CurrentTime.wMonth,
CurrentTime.wDay);
SetLocaltime(currentTime);
NMDayTime1.Destroy;
end;
http://www.codeguru.com/internet/AtomicSync.html