Skip to content

Instantly share code, notes, and snippets.

@mahan
Created December 21, 2015 10:59
Show Gist options
  • Save mahan/484a708483de739961b0 to your computer and use it in GitHub Desktop.
Save mahan/484a708483de739961b0 to your computer and use it in GitHub Desktop.
unit ufMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
uLogger,
DateUtils;
{$R *.dfm}
const
LOG_NAME = 'my_test_log';
function MilliSecs: Int64;
begin
result := DateUtils.MilliSecondsBetween(Now, 0);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
startTime: int64;
begin
TLogger.LoggerAccessor(LOG_NAME).Log('Nu skall vi göra en grej som tar lite tid ...');
startTime := MilliSecs();
TThread.Sleep(500);
TLogger.LoggerAccessor(LOG_NAME).Log(format('... det tog %d millisekunder att utföra.', [(MilliSecs() - startTime)]));
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment