mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-07 20:11:44 +01:00
* SetDate, SetTime corrected
This commit is contained in:
parent
72c8dbfa43
commit
0baf0745bc
@ -279,7 +279,7 @@ procedure setftime(var f;time : longint);
|
|||||||
begin
|
begin
|
||||||
if os_mode = osOS2 then
|
if os_mode = osOS2 then
|
||||||
begin
|
begin
|
||||||
{!!! Must be done differently for OS/2 !!!}
|
{TODO!!! Must be done differently for OS/2 !!!}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
asm
|
asm
|
||||||
@ -545,19 +545,23 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure setdate(year,month,day : word);
|
procedure SetDate (Year, Month, Day: word);
|
||||||
|
var DT: TDateTime;
|
||||||
begin
|
begin
|
||||||
if os_mode = osOS2 then
|
if os_mode = osOS2 then
|
||||||
begin
|
begin
|
||||||
{TODO: !!! Must be done differently for OS/2 !!!}
|
DosGetDateTime (DT);
|
||||||
|
DT.Year := Year;
|
||||||
|
DT.Month := Month;
|
||||||
|
DT.Day := Day;
|
||||||
|
DosSetDateTime (DT);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
asm
|
asm
|
||||||
movw 8(%ebp),%cx
|
movw Year, %cx
|
||||||
movb 10(%ebp),%dh
|
movb Month, %dh
|
||||||
movb 12(%ebp),%dl
|
movb Day, %dl
|
||||||
movb $0x2b,%ah
|
movb $0x2b, %ah
|
||||||
call syscall
|
call syscall
|
||||||
(* SetDate isn't supposed to change DosError!!!
|
(* SetDate isn't supposed to change DosError!!!
|
||||||
xorb %ah,%ah
|
xorb %ah,%ah
|
||||||
@ -566,41 +570,48 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure gettime(var hour,minute,second,sec100:word);
|
procedure GetTime (var Hour, Minute, Second, Sec100: word); assembler;
|
||||||
|
asm
|
||||||
begin
|
movb $0x2c, %ah
|
||||||
asm
|
|
||||||
movb $0x2c,%ah
|
|
||||||
call syscall
|
call syscall
|
||||||
xorb %ah,%ah
|
xorb %ah, %ah
|
||||||
movl 20(%ebp),%edi
|
movl Sec100, %edi
|
||||||
movb %dl,%al
|
movb %dl, %al
|
||||||
stosw
|
stosw
|
||||||
movl 16(%ebp),%edi
|
movl Second, %edi
|
||||||
movb %dh,%al
|
movb %dh,%al
|
||||||
stosw
|
stosw
|
||||||
movl 12(%ebp),%edi
|
movl Minute, %edi
|
||||||
movb %cl,%al
|
movb %cl,%al
|
||||||
stosw
|
stosw
|
||||||
movl 8(%ebp),%edi
|
movl Hour, %edi
|
||||||
movb %ch,%al
|
movb %ch,%al
|
||||||
stosw
|
stosw
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure settime(hour,minute,second,sec100:word);
|
procedure SetTime (Hour, Minute, Second, Sec100: word);
|
||||||
(* TODO: Syscall 58h (__settime) should be used instead!!! *)
|
var DT: TDateTime;
|
||||||
begin
|
begin
|
||||||
|
if os_mode = osOS2 then
|
||||||
|
begin
|
||||||
|
DosGetDateTime (DT);
|
||||||
|
DT.Hour := Hour;
|
||||||
|
DT.Minute := Minute;
|
||||||
|
DT.Second := Second;
|
||||||
|
DT.Sec100 := Sec100;
|
||||||
|
DosSetDateTime (DT);
|
||||||
|
end
|
||||||
|
else
|
||||||
asm
|
asm
|
||||||
movb 8(%ebp),%ch
|
movb Hour, %ch
|
||||||
movb 10(%ebp),%cl
|
movb Minute ,%cl
|
||||||
movb 12(%ebp),%dh
|
movb Second, %dh
|
||||||
movb 14(%ebp),%dl
|
movb Sec100, %dl
|
||||||
movb $0x2d,%ah
|
movb $0x2d, %ah
|
||||||
call syscall
|
call syscall
|
||||||
(* SetTime isn't supposed to change DosError!!!
|
(* SetTime isn't supposed to change DosError!!!
|
||||||
xorb %ah,%ah
|
xorb %ah, %ah
|
||||||
movw %ax,doserror
|
movw %ax, DosError
|
||||||
*)
|
*)
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1183,7 +1194,10 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.26 2000-06-01 18:38:46 hajny
|
Revision 1.27 2000-06-05 18:50:55 hajny
|
||||||
|
* SetDate, SetTime corrected
|
||||||
|
|
||||||
|
Revision 1.26 2000/06/01 18:38:46 hajny
|
||||||
* warning about SetDate added (TODO)
|
* warning about SetDate added (TODO)
|
||||||
|
|
||||||
Revision 1.25 2000/05/28 18:20:16 hajny
|
Revision 1.25 2000/05/28 18:20:16 hajny
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user