mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 23:59:10 +02:00
* move TZSeconds to lcommon
git-svn-id: trunk@5356 -
This commit is contained in:
parent
ddbbcb875e
commit
6d34a8a864
@ -93,11 +93,13 @@ type
|
|||||||
|
|
||||||
function IsBlockError(const anError: Integer): Boolean; inline;
|
function IsBlockError(const anError: Integer): Boolean; inline;
|
||||||
|
|
||||||
|
function TZSeconds: Integer; inline;
|
||||||
|
|
||||||
function StrToHostAddr(const IP: string): Cardinal; inline;
|
function StrToHostAddr(const IP: string): Cardinal; inline;
|
||||||
function HostAddrToStr(const Entry: Cardinal): string; inline;
|
function HostAddrToStr(const Entry: Cardinal): string; inline;
|
||||||
function StrToNetAddr(const IP: string): Cardinal; inline;
|
function StrToNetAddr(const IP: string): Cardinal; inline;
|
||||||
function NetAddrToStr(const Entry: Cardinal): string; inline;
|
function NetAddrToStr(const Entry: Cardinal): string; inline;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$IFNDEF UNIX}
|
{$IFNDEF UNIX}
|
||||||
@ -131,6 +133,17 @@ begin
|
|||||||
Result:=Tmp;
|
Result:=Tmp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TZSeconds: integer; inline;
|
||||||
|
var
|
||||||
|
lInfo: Windows.TIME_ZONE_INFORMATION;
|
||||||
|
begin
|
||||||
|
{ lInfo.Bias is in minutes }
|
||||||
|
if Windows.GetTimeZoneInformation(@lInfo) <> $FFFFFFFF then
|
||||||
|
Result := lInfo.Bias * 60
|
||||||
|
else
|
||||||
|
Result := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
|
|
||||||
function LStrError(const Ernum: Longint; const UseUTF8: Boolean = False): string;
|
function LStrError(const Ernum: Longint; const UseUTF8: Boolean = False): string;
|
||||||
@ -138,6 +151,11 @@ begin
|
|||||||
Result:=IntToStr(Ernum); // TODO: fix for non-windows winsock users
|
Result:=IntToStr(Ernum); // TODO: fix for non-windows winsock users
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TZSeconds: integer; inline;
|
||||||
|
begin
|
||||||
|
Result:=0; // todo: fix for non-windows non unix
|
||||||
|
end;
|
||||||
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
function LSocketError: Longint;
|
function LSocketError: Longint;
|
||||||
@ -220,7 +238,7 @@ end;
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
// unix
|
// unix
|
||||||
uses
|
uses
|
||||||
Errors;
|
Errors, UnixUtil;
|
||||||
|
|
||||||
function LStrError(const Ernum: Longint; const UseUTF8: Boolean = False): string;
|
function LStrError(const Ernum: Longint; const UseUTF8: Boolean = False): string;
|
||||||
begin
|
begin
|
||||||
@ -282,6 +300,11 @@ begin
|
|||||||
Result:=(anError = ESysEWOULDBLOCK) or (anError = ESysENOBUFS);
|
Result:=(anError = ESysEWOULDBLOCK) or (anError = ESysENOBUFS);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TZSeconds: Integer; inline;
|
||||||
|
begin
|
||||||
|
Result := unixutil.TZSeconds;
|
||||||
|
end;
|
||||||
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
function StrToHostAddr(const IP: string): Cardinal; inline;
|
function StrToHostAddr(const IP: string): Cardinal; inline;
|
||||||
|
@ -477,6 +477,9 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
lCommon;
|
||||||
|
|
||||||
const
|
const
|
||||||
RequestBufferSize = 1024;
|
RequestBufferSize = 1024;
|
||||||
DataBufferSize = 16*1024;
|
DataBufferSize = 16*1024;
|
||||||
|
@ -30,9 +30,6 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
sysutils,
|
sysutils,
|
||||||
{$ifdef UNIX}
|
|
||||||
unixutil,
|
|
||||||
{$endif}
|
|
||||||
strutils;
|
strutils;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -43,7 +40,6 @@ const
|
|||||||
type
|
type
|
||||||
PSearchRec = ^TSearchRec;
|
PSearchRec = ^TSearchRec;
|
||||||
|
|
||||||
function TZSeconds: integer;
|
|
||||||
function GMTToLocalTime(ADateTime: TDateTime): TDateTime;
|
function GMTToLocalTime(ADateTime: TDateTime): TDateTime;
|
||||||
function LocalTimeToGMT(ADateTime: TDateTime): TDateTime;
|
function LocalTimeToGMT(ADateTime: TDateTime): TDateTime;
|
||||||
function TryHTTPDateStrToDateTime(ADateStr: pchar; var ADest: TDateTime): boolean;
|
function TryHTTPDateStrToDateTime(ADateStr: pchar; var ADest: TDateTime): boolean;
|
||||||
@ -57,41 +53,8 @@ function HexToNum(AChar: char): byte;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$ifdef WINDOWS}
|
|
||||||
|
|
||||||
uses
|
uses
|
||||||
windows;
|
lCommon;
|
||||||
|
|
||||||
function TZSeconds: integer;
|
|
||||||
var
|
|
||||||
lInfo: Windows.TIME_ZONE_INFORMATION;
|
|
||||||
begin
|
|
||||||
{ lInfo.Bias is in minutes }
|
|
||||||
if Windows.GetTimeZoneInformation(@lInfo) <> $FFFFFFFF then
|
|
||||||
Result := lInfo.Bias * 60
|
|
||||||
else
|
|
||||||
Result := 0;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$else}
|
|
||||||
|
|
||||||
{$ifdef UNIX}
|
|
||||||
|
|
||||||
function TZSeconds: integer; inline;
|
|
||||||
begin
|
|
||||||
Result := unixutil.TZSeconds;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$else}
|
|
||||||
|
|
||||||
function TZSeconds: integer; inline;
|
|
||||||
begin
|
|
||||||
Result := 0; // TODO: implement for non windows, non unix
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
function GMTToLocalTime(ADateTime: TDateTime): TDateTime;
|
function GMTToLocalTime(ADateTime: TDateTime): TDateTime;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user