[Lazarus] Now function - returning UTC?

silvioprog silvioprog at gmail.com
Sat Apr 19 17:41:22 CEST 2014


2014-04-19 12:37 GMT-03:00 David Taylor <david-taylor at blueyonder.co.uk>:

> I have a version of the Now function which works in Windows and returns
> UTC.
>
> function NowUTC: TDateTime;
> var
>   system_datetime: TSystemTime;
> begin
>   GetSystemTime (system_datetime);
>   Result := SystemTimeToDateTime (system_datetime);
> end;


I'm used this:

class function TDropboxOAuthUtil.GenerateTimeStamp: string;
{$IFNDEF FPC}
var
  VCurTime: TSystemTime;
{$ENDIF}
begin
{$IFNDEF FPC}
  GetSystemTime(VCurTime);
{$ENDIF}
  Result := IntToStr(DateTimeToUnix({$IFDEF
FPC}LocalTimeToUniversal(Now){$ELSE}
    SystemTimeToDateTime(VCurTime){$ENDIF}));
end;

-- 
Silvio Cl├ęcio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20140419/12ee471b/attachment-0003.html>


More information about the Lazarus mailing list