[fpc-devel] Add {$I %DATETIME%}

Denis Kozlov dezlov at gmail.com
Sat Feb 27 13:32:25 CET 2016


On 27/02/2016 12:08, Jonas Maebe wrote:
> If something is platform-specific, it generally does not belong as a 
> language extension. 

It's the same as existing %DATE% and %TIME%, plus few mathematical 
operations, no extra dependencies.

// Existing function used for %DATE% in globals.pas:
function getdatestr:string;
var
   st: TSystemTime;
begin
   GetLocalTime(st);
   getdatestr:=L0(st.Year)+'/'+L0(st.Month)+'/'+L0(st.Day);
end;

// Proposed function for %TIMESTAMP%
function GetTimestampStr: String;
begin
   GetTimestampStr := 
IntToStr(Round(TimeStampToMSecs(DateTimeToTimeStamp(Now))));
end;


Denis



More information about the fpc-devel mailing list