mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-30 05:53:12 +01:00
* remove sysutils
This commit is contained in:
parent
4a4c940fc4
commit
5ef188da6f
@ -66,7 +66,7 @@ Procedure AddDisk(const path:string);
|
|||||||
Implementation
|
Implementation
|
||||||
|
|
||||||
Uses
|
Uses
|
||||||
Strings,SysUtils,Unix,BaseUnix,Syscall;
|
Strings,Unix,BaseUnix,Syscall;
|
||||||
|
|
||||||
|
|
||||||
{$i sysnr.inc}
|
{$i sysnr.inc}
|
||||||
@ -129,7 +129,7 @@ Function LocalToEpoch(year,month,day,hour,minute,second:Word):Longint;
|
|||||||
{
|
{
|
||||||
Transforms local time (year,month,day,hour,minutes,second) to Epoch time
|
Transforms local time (year,month,day,hour,minutes,second) to Epoch time
|
||||||
(seconds since 00:00, january 1 1970, corrected for local time zone)
|
(seconds since 00:00, january 1 1970, corrected for local time zone)
|
||||||
}
|
}
|
||||||
Begin
|
Begin
|
||||||
LocalToEpoch:=((GregorianToJulian(Year,Month,Day)-c1970)*86400)+
|
LocalToEpoch:=((GregorianToJulian(Year,Month,Day)-c1970)*86400)+
|
||||||
(LongInt(Hour)*3600)+(Longint(Minute)*60)+Second-TZSeconds;
|
(LongInt(Hour)*3600)+(Longint(Minute)*60)+Second-TZSeconds;
|
||||||
@ -151,7 +151,7 @@ Begin
|
|||||||
inc(YYear);
|
inc(YYear);
|
||||||
dec(TempMonth,12);
|
dec(TempMonth,12);
|
||||||
End;
|
End;
|
||||||
inc(TempMonth,3);
|
inc(TempMonth,3);
|
||||||
Month := TempMonth;
|
Month := TempMonth;
|
||||||
Year:=YYear+(JulianDN*100);
|
Year:=YYear+(JulianDN*100);
|
||||||
end;
|
end;
|
||||||
@ -227,15 +227,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Procedure GetDate(Var Year, Month, MDay, WDay: Word);
|
Procedure GetDate(Var Year, Month, MDay, WDay: Word);
|
||||||
|
var
|
||||||
var t :TSystemtime;
|
tz:timeval;
|
||||||
|
hour,min,sec : word;
|
||||||
Begin
|
begin
|
||||||
sysutils.getlocaltime(t);
|
fpgettimeofday(@tz,nil);
|
||||||
mday:=t.day;
|
EpochToLocal(tz.tv_sec,year,month,mday,hour,min,sec);
|
||||||
month:=t.month;
|
|
||||||
year:=t.year;
|
|
||||||
Wday:=weekday(Year,Month,MDay);
|
Wday:=weekday(Year,Month,MDay);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -243,7 +242,7 @@ end;
|
|||||||
procedure SetTime(Hour,Minute,Second,sec100:word);
|
procedure SetTime(Hour,Minute,Second,sec100:word);
|
||||||
var
|
var
|
||||||
dow,Year, Month, Day : Word;
|
dow,Year, Month, Day : Word;
|
||||||
|
|
||||||
tv : timeval;
|
tv : timeval;
|
||||||
begin
|
begin
|
||||||
GetDate (Year, Month, Day,dow);
|
GetDate (Year, Month, Day,dow);
|
||||||
@ -270,15 +269,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure GetTime(Var Hour, Minute, Second, Sec100: Word);
|
Procedure GetTime(Var Hour, Minute, Second, Sec100: Word);
|
||||||
|
var
|
||||||
var t :TSystemtime;
|
tz:timeval;
|
||||||
|
year,month,day : word;
|
||||||
Begin
|
begin
|
||||||
sysutils.getlocaltime(t);
|
fpgettimeofday(@tz,nil);
|
||||||
sec100:=0;
|
EpochToLocal(tz.tv_sec,year,month,day,hour,minute,second);
|
||||||
second:=t.second;
|
sec100:=tz.tv_usec div 10000;
|
||||||
minute:=t.minute;
|
|
||||||
hour :=t.hour;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure packtime(var t : datetime;var p : longint);
|
Procedure packtime(var t : datetime;var p : longint);
|
||||||
@ -355,9 +352,9 @@ Procedure Exec (Const Path: PathStr; Const ComLine: ComStr);
|
|||||||
var
|
var
|
||||||
pid : longint; // pid_t?
|
pid : longint; // pid_t?
|
||||||
cmdline2 : ppchar;
|
cmdline2 : ppchar;
|
||||||
commandline : ansistring;
|
commandline : ansistring;
|
||||||
realpath : ansistring;
|
realpath : ansistring;
|
||||||
|
|
||||||
// The Error-Checking in the previous Version failed, since halt($7F) gives an WaitPid-status of $7F00
|
// The Error-Checking in the previous Version failed, since halt($7F) gives an WaitPid-status of $7F00
|
||||||
Begin
|
Begin
|
||||||
LastDosExitCode:=0;
|
LastDosExitCode:=0;
|
||||||
@ -378,10 +375,10 @@ Begin
|
|||||||
cmdline2^:=pchar(realPath);
|
cmdline2^:=pchar(realPath);
|
||||||
cmdline2[1]:=nil;
|
cmdline2[1]:=nil;
|
||||||
end;
|
end;
|
||||||
{The child does the actual exec, and then exits}
|
{The child does the actual exec, and then exits}
|
||||||
fpExecv(pchar(realPath),cmdline2);
|
fpExecv(pchar(realPath),cmdline2);
|
||||||
{If the execve fails, we return an exitvalue of 127, to let it be known}
|
{If the execve fails, we return an exitvalue of 127, to let it be known}
|
||||||
fpExit(127);
|
fpExit(127);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if pid=-1 then {Fork failed}
|
if pid=-1 then {Fork failed}
|
||||||
@ -389,12 +386,12 @@ Begin
|
|||||||
DosError:=8;
|
DosError:=8;
|
||||||
exit
|
exit
|
||||||
end;
|
end;
|
||||||
{We're in the parent, let's wait.}
|
{We're in the parent, let's wait.}
|
||||||
LastDosExitCode:=WaitProcess(pid); // WaitPid and result-convert
|
LastDosExitCode:=WaitProcess(pid); // WaitPid and result-convert
|
||||||
if (LastDosExitCode>=0) and (LastDosExitCode<>127) then
|
if (LastDosExitCode>=0) and (LastDosExitCode<>127) then
|
||||||
DosError:=0
|
DosError:=0
|
||||||
else
|
else
|
||||||
DosError:=8; // perhaps one time give an better error
|
DosError:=8; // perhaps one time give an better error
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
@ -1047,7 +1044,10 @@ End.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.36 2004-10-30 20:55:54 marco
|
Revision 1.37 2004-10-31 16:20:58 peter
|
||||||
|
* remove sysutils
|
||||||
|
|
||||||
|
Revision 1.36 2004/10/30 20:55:54 marco
|
||||||
* unix interface cleanup
|
* unix interface cleanup
|
||||||
|
|
||||||
Revision 1.35 2004/09/25 15:09:57 peter
|
Revision 1.35 2004/09/25 15:09:57 peter
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user