프로그램/바로쓰는델파이

시간관련 함수 테스트

mulderu 2008. 1. 21. 01:34
unit StudyMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Memo1: TMemo;
    Memo2: TMemo;
    btnDateTest: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    procedure btnDateTestClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure addLog(s:string);
    procedure addLog2(s1, s2:string);
    procedure addLog3(s1, s2, s3:string);
  end;

var
  Form1: TForm1;
  FormCreateTime: TDateTime;

implementation

{$R *.dfm}


procedure TForm1.addLog(s:string);
begin
    Memo1.Lines.Add (s);
end;

procedure TForm1.addLog2(s1, s2:string);
begin
    addLog (s1 +','+ s2);
end;

procedure TForm1.addLog3(s1, s2, s3:string);
begin
    addLog (s1 +','+ s2 +','+ s3);
end;


procedure TForm1.btnDateTestClick(Sender: TObject);
begin
    addLog (TimeToStr (Now));
    addLog (DateToStr (Now));
    addLog (FormatDateTime ('hh:nn:ss', Now - FormCreateTime));


end;

procedure TForm1.FormCreate(Sender: TObject);
begin
    FormCreateTime := Now;
end;

end.