{*******************************************************************
ФАЙЛ : TIMEEX.PAS
ПРИМЕЧАНИЕ : Создайте форму, содержащую 1 TTimer и 6 TLabel. Установите событие OnTimer у TTimer на TForm.Timer1.Timer
********************************************************************}
unit Time;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel; {Caption : 'Старт :'}
Label2: TLabel;
Label3: TLabel; {Caption : 'Время : '}
Label4: TLabel;
Label5: TLabel; {Caption : 'Истекшее время:'}
Label6: TLabel;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
TimeStart : TDateTime;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
TimeStart := Now;
Label2.Caption := TimeToStr(Now);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
tt : TDateTime;
begin
Label4.Caption := TimeToStr(Now);
tt:= Now - TimeStart;
Label6.Caption:= TimeToStr(tt);
end;
end.