home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 November / Chip_2002-11_cd1.bin / zkuste / delphi / kompon / d3456 / SYNAPSE.ZIP / source / demo / sntp / Unit1.pas < prev   
Pascal/Delphi Source File  |  2000-03-19  |  770b  |  46 lines

  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   SNTPsend, StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Edit1: TEdit;
  12.     Label1: TLabel;
  13.     Button1: TButton;
  14.     Label2: TLabel;
  15.     procedure Button1Click(Sender: TObject);
  16.   private
  17.     { Private declarations }
  18.   public
  19.     { Public declarations }
  20.   end;
  21.  
  22. var
  23.   Form1: TForm1;
  24.  
  25. implementation
  26.  
  27. {$R *.DFM}
  28.  
  29. procedure TForm1.Button1Click(Sender: TObject);
  30. var
  31.   sntp:TSntpSend;
  32. begin
  33.   sntp:=TSntpSend.Create;
  34.   try
  35.     sntp.SntpHost:=Edit1.Text;
  36.     if sntp.GetNTP
  37.       then label2.Caption:=Datetimetostr(sntp.NTPTime)+' UTC'
  38.       else label2.Caption:='Not contacted!';
  39.   finally
  40.     sntp.Free;
  41.   end;
  42. end;
  43.  
  44. end.
  45.  
  46.