in 10.4 sieht UnixToDateTime so aus:
Delphi-Quellcode:
function UnixToDateTime(const AValue: Int64; AReturnUTC: Boolean): TDateTime;
begin
if AReturnUTC then
Result := IncSecond(UnixDateDelta, AValue)
else
Result := TTimeZone.Local.ToLocalTime(IncSecond(UnixDateDelta, AValue));
end;
Da es TTimeZone in D2010 noch nicht gibt, muss dies wieder ersetzt werden.
Delphi-Quellcode:
function TzSpecificLocalTimeToSystemTime(lpTimeZoneInformation: PTimeZoneInformation; var lpLocalTime, lpUniversalTime: TSystemTime): BOOL; stdcall;
function SystemTimeToTzSpecificLocalTime(lpTimeZoneInformation: PTimeZoneInformation; var lpUniversalTime,lpLocalTime: TSystemTime): BOOL; stdcall;
implementation
function TzSpecificLocalTimeToSystemTime; external kernel32 name 'TzSpecificLocalTimeToSystemTime';
function SystemTimeToTzSpecificLocalTime; external kernel32 name 'SystemTimeToTzSpecificLocalTime';
Function UtcToLocalDateTime(d:TDateTime):TDateTime;
var
TZI:TTimeZoneInformation;
LocalTime, UniversalTime:TSystemTime;
begin
GetTimeZoneInformation(tzi);
DateTimeToSystemTime(d,UniversalTime);
SystemTimeToTzSpecificLocalTime(@tzi,UniversalTime,LocalTime);
Result := SystemTimeToDateTime(LocalTime);
end;
->>
Delphi-Quellcode:
function UnixToDateTime(const AValue: Int64; AReturnUTC: Boolean): TDateTime;
begin
if AReturnUTC then
Result := IncSecond(UnixDateDelta, AValue)
else
Result := UtcToLocalDateTime(IncSecond(UnixDateDelta, AValue));
end;
Grüße
Klaus