+ Added setdate/time/datetime functions

This commit is contained in:
michael 2001-07-12 07:20:05 +00:00
parent b75e34ff07
commit 6e4906ff87
3 changed files with 104 additions and 5 deletions

View File

@ -258,7 +258,7 @@ end;
Procedure SetDate(Year, Month, Day: Word);
Begin
{!!}
Linux.SetDate ( Year, Month, Day );
End;
@ -272,7 +272,7 @@ end;
Procedure SetTime(Hour, Minute, Second, Sec100: Word);
Begin
{!!}
Linux.SetTime ( Hour, Minute, Second );
End;
@ -877,7 +877,10 @@ End.
{
$Log$
Revision 1.6 2001-06-03 20:19:09 peter
Revision 1.7 2001-07-12 07:20:05 michael
+ Added setdate/time/datetime functions
Revision 1.6 2001/06/03 20:19:09 peter
* FSStat to StatFS
* StatFS structure to TStatFS

View File

@ -211,6 +211,9 @@ procedure GetTime(var hour,min,sec,sec100:word);
procedure GetTime(var hour,min,sec:word);
Procedure GetDate(Var Year,Month,Day:Word);
Procedure GetDateTime(Var Year,Month,Day,hour,minute,second:Word);
function SetTime(Hour,Min,Sec:word) : Boolean;
function SetDate(Year,Month,Day:Word) : Boolean;
function SetDateTime(Year,Month,Day,hour,minute,second:Word) : Boolean;
{**************************
Process Handling
@ -871,6 +874,49 @@ Begin
EpochToLocal(GetTimeOfDay,year,month,day,hour,minute,second);
End;
{$ifdef linux}
Function stime (t : longint) : Boolean;
var
sr : Syscallregs;
begin
sr.reg2:=longint(@t);
SysCall(Syscall_nr_stime,sr);
linuxerror:=errno;
stime:=linuxerror=0;
end;
{$endif}
{$ifdef BSD}
Function stime (t : longint) : Boolean;
begin
end;
{$endif}
Function SetTime(Hour,Min,Sec:word) : boolean;
var
Year, Month, Day : Word;
begin
GetDate (Year, Month, Day);
SetTime:=stime ( LocalToEpoch ( Year, Month, Day, Hour, Min, Sec ) );
end;
Function SetDate(Year,Month,Day:Word) : boolean;
var
Hour, Minute, Second, Sec100 : Word;
begin
GetTime ( Hour, Minute, Second, Sec100 );
SetDate:=stime ( LocalToEpoch ( Year, Month, Day, Hour, Minute, Second ) );
end;
Function SetDateTime(Year,Month,Day,hour,minute,second:Word) : Boolean;
begin
SetDateTime:=stime ( LocalToEpoch ( Year, Month, Day, Hour, Minute, Second ) );
end;
{ Include timezone handling routines which use /usr/share/timezone info }
{$i timezone.inc}
@ -2890,7 +2936,10 @@ End.
{
$Log$
Revision 1.11 2001-07-10 18:04:37 peter
Revision 1.12 2001-07-12 07:20:05 michael
+ Added setdate/time/datetime functions
Revision 1.11 2001/07/10 18:04:37 peter
* merged textfile, readlink and concat ansistring fixes
Revision 1.10 2001/06/03 20:19:09 peter

View File

@ -211,6 +211,10 @@ procedure GetTime(var hour,min,sec,sec100:word);
procedure GetTime(var hour,min,sec:word);
Procedure GetDate(Var Year,Month,Day:Word);
Procedure GetDateTime(Var Year,Month,Day,hour,minute,second:Word);
function SetTime(Hour,Min,Sec:word) : Boolean;
function SetDate(Year,Month,Day:Word) : Boolean;
function SetDateTime(Year,Month,Day,hour,minute,second:Word) : Boolean;
{**************************
Process Handling
@ -871,6 +875,46 @@ Begin
EpochToLocal(GetTimeOfDay,year,month,day,hour,minute,second);
End;
{$ifdef linux}
Function stime (t : longint) : Boolean;
var
sr : Syscallregs;
begin
sr.reg2:=longint(@t);
SysCall(Syscall_nr_stime,sr);
linuxerror:=errno;
stime:=linuxerror=0;
end;
{$endif}
{$ifdef BSD}
Function stime (t : longint) : Boolean;
begin
end;
{$endif}
Function SetTime(Hour,Min,Sec:word) : boolean;
var
Year, Month, Day : Word;
begin
GetDate (Year, Month, Day);
SetTime:=stime ( LocalToEpoch ( Year, Month, Day, Hour, Min, Sec ) );
end;
Function SetDate(Year,Month,Day:Word) : boolean;
var
Hour, Minute, Second, Sec100 : Word;
begin
GetTime ( Hour, Minute, Second, Sec100 );
SetDate:=stime ( LocalToEpoch ( Year, Month, Day, Hour, Minute, Second ) );
end;
Function SetDateTime(Year,Month,Day,hour,minute,second:Word) : Boolean;
begin
SetDateTime:=stime ( LocalToEpoch ( Year, Month, Day, Hour, Minute, Second ) );
end;
{ Include timezone handling routines which use /usr/share/timezone info }
{$i timezone.inc}
@ -2887,7 +2931,10 @@ End.
{
$Log$
Revision 1.12 2001-06-20 15:24:47 marco
Revision 1.13 2001-07-12 07:20:05 michael
+ Added setdate/time/datetime functions
Revision 1.12 2001/06/20 15:24:47 marco
* readlink for Unix fix.
Revision 1.11 2001/06/19 17:19:50 marco