0
votes

I am trying to find an extended description about the function Now(), which returns time. On the official FreePascal site is this description:

Now returns the current date and time. It is equivalent to Date+Time.

I am looking for time which is measured from the epoch January, 1, 1970 00:00:00 in FreePascal.

Can you help me?

1
The integral part of TDateTime is the number of days since 12/30/1899. If you want unix time, see DateTimeToUnix. - LU RD

1 Answers

4
votes

Pascal has a very different idea of the "Start of Time" one that I think is more mathematically simple, as well as just makes better sense. At any rate, if I understand your question right, I think you are looking for something like a Unix Timestamp value?

This is how you would get that in FreePascal:

uses sysutils, dateutils;

function GetUnixNow() : Int64;
begin
  Result := DateTimeToUnix(Now());
end;

Calling this function will return a 64bit Integer that is the equivalent to (unsigned long)time(NULL); in C11