source: trunk/Packages/synapse/source/demo/sntp/Unit1.pas

Last change on this file was 2, checked in by chronos, 12 years ago
  • Přidáno: Základní kostra projektu.
  • Přidáno: Knihovna synapse.
File size: 773 bytes
Line 
1unit Unit1;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 SNTPsend, StdCtrls;
8
9type
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
22var
23 Form1: TForm1;
24
25implementation
26
27{$R *.DFM}
28
29procedure TForm1.Button1Click(Sender: TObject);
30var
31 sntp:TSntpSend;
32begin
33 sntp:=TSntpSend.Create;
34 try
35 sntp.TargetHost:=Edit1.Text;
36 if sntp.GetSNTP
37 then label2.Caption:=Datetimetostr(sntp.NTPTime)+' UTC'
38 else label2.Caption:='Not contacted!';
39 finally
40 sntp.Free;
41 end;
42end;
43
44end.
45
Note: See TracBrowser for help on using the repository browser.