> for me.  It needs both the SysUtils and Libc units, which I'm already using 
> for other declarations anyway.

Libc is a legacy unit, better use the proper (portable) units, and you'll
spare yourself a libc dependancy, AND make it portable across unices:

{$mode Delphi}
uses unix,sysutils,baseunix;

 function utc_now : TDateTime;
 var
   timeval: TTimeVal;
   timezone: PTimeZone;
   a: Double;
 begin
   TimeZone := nil;
   fpGetTimeOfDay (@TimeVal, TimeZone);
   // Convert to milliseconds
   a := (TimeVal.tv_sec * 1000.0) + (TimeVal.tv_usec / 1000.0);
   Result := (a / MSecsPerDay) + UnixDateDelta;
 end;

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to