1
0
mirror of synced 2024-11-21 19:03:50 +00:00

Added wrapper for TDateTime

This commit is contained in:
Mark van Renswoude 2016-10-15 09:17:33 +02:00
parent 24dc9481bd
commit dee64510b6

View File

@ -98,6 +98,51 @@ type
end; end;
type
IX2LogDateTime = interface
['{F0E6196B-C7E7-46C9-8764-D457AB957534}']
function GetValue: TDateTime;
property Value: TDateTime read GetValue;
end;
{ Use this wrapper when passing a TDateTime to one of the structured logging
methods, otherwise Delphi will pass it as a floating point value. }
function DT(AValue: TDateTime): IX2LogDateTime;
implementation implementation
type
TX2LogDateTime = class(TInterfacedObject, IX2LogDateTime)
private
FValue: TDateTime;
public
constructor Create(AValue: TDateTime);
function GetValue: TDateTime;
end;
function DT(AValue: TDateTime): IX2LogDateTime;
begin
Result := TX2LogDateTime.Create(AValue);
end;
{ TX2LogDateTime }
constructor TX2LogDateTime.Create(AValue: TDateTime);
begin
inherited Create;
FValue := AValue;
end;
function TX2LogDateTime.GetValue: TDateTime;
begin
Result := FValue;
end;
end. end.