From 433a1b7339e2bf96f3b0bb4c98b8c799c6540027 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Sep 2007 13:19:20 +0000 Subject: changes in order to compile in lazarus... minor tidy ups and removal of big old comment blocks.. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@394 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULight.pas | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'Game/Code/Classes/ULight.pas') diff --git a/Game/Code/Classes/ULight.pas b/Game/Code/Classes/ULight.pas index b9c7af9e..74681a85 100644 --- a/Game/Code/Classes/ULight.pas +++ b/Game/Code/Classes/ULight.pas @@ -36,6 +36,32 @@ uses zlportio, {$ENDIF} UTime; + +{$IFDEF FPC} + function GetTime: TDateTime; + {$IFDEF MSWINDOWS} + var + SystemTime: TSystemTime; + begin + GetLocalTime(SystemTime); + with SystemTime do + Result := EncodeTime(wHour, wMinute, wSecond, wMilliSeconds); + end; + {$ENDIF} + {$IFDEF LINUX} + var + T: TTime_T; + TV: TTimeVal; + UT: TUnixTime; + begin + gettimeofday(TV, nil); + T := TV.tv_sec; + localtime_r(@T, UT); + Result := EncodeTime(UT.tm_hour, UT.tm_min, UT.tm_sec, TV.tv_usec div 1000); + end; + {$ENDIF} +{$ENDIF} + constructor TLight.Create; begin @@ -44,7 +70,7 @@ end; procedure TLight.Enable; begin - Enabled := true; + Enabled := true; LastTime := GetTime; end; -- cgit v1.2.3