mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-24 02:00:34 +02:00
* GetLocatTime now also native
This commit is contained in:
parent
c44c76cd3b
commit
81e7e0aa7c
@ -225,6 +225,22 @@ function DosSetPathInfo(FileName:PChar;InfoLevel:longint;
|
|||||||
Options:longint):longint; cdecl;
|
Options:longint):longint; cdecl;
|
||||||
external 'DOSCALLS' index 219;
|
external 'DOSCALLS' index 219;
|
||||||
|
|
||||||
|
type
|
||||||
|
TDT=packed record
|
||||||
|
Hour,
|
||||||
|
Minute,
|
||||||
|
Second,
|
||||||
|
Sec100,
|
||||||
|
Day,
|
||||||
|
Month: byte;
|
||||||
|
Year: word;
|
||||||
|
TimeZone: smallint;
|
||||||
|
WeekDay: byte;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function DosGetDateTime(var Buf: TDT):longint; cdecl;
|
||||||
|
external 'DOSCALLS' index 230;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
File Functions
|
File Functions
|
||||||
@ -640,36 +656,23 @@ end {['eax', 'ecx', 'edx']};
|
|||||||
Time Functions
|
Time Functions
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
procedure GetLocalTime (var SystemTime: TSystemTime); assembler;
|
procedure GetLocalTime (var SystemTime: TSystemTime);
|
||||||
asm
|
var
|
||||||
(* Expects the default record alignment (word)!!! *)
|
DT: TDT;
|
||||||
push edi
|
begin
|
||||||
mov ah, 2Ah
|
DosGetDateTime(DT);
|
||||||
call syscall
|
with SystemTime do
|
||||||
mov edi, SystemTime
|
begin
|
||||||
mov ax, cx
|
Year:=DT.Year;
|
||||||
stosw
|
Month:=DT.Month;
|
||||||
xor eax, eax
|
Day:=DT.Day;
|
||||||
mov al, 10
|
Hour:=DT.Hour;
|
||||||
mul dl
|
Minute:=DT.Minute;
|
||||||
shl eax, 16
|
Second:=DT.Second;
|
||||||
mov al, dh
|
MilliSecond:=DT.Sec100;
|
||||||
stosd
|
end;
|
||||||
push edi
|
end;
|
||||||
mov ah, 2Ch
|
|
||||||
call syscall
|
|
||||||
pop edi
|
|
||||||
xor eax, eax
|
|
||||||
mov al, cl
|
|
||||||
shl eax, 16
|
|
||||||
mov al, ch
|
|
||||||
stosd
|
|
||||||
mov al, dl
|
|
||||||
shl eax, 16
|
|
||||||
mov al, dh
|
|
||||||
stosd
|
|
||||||
pop edi
|
|
||||||
end {['eax', 'ecx', 'edx', 'edi']};
|
|
||||||
{$asmmode default}
|
{$asmmode default}
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
@ -767,7 +770,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.35 2003-10-27 11:43:40 yuri
|
Revision 1.36 2003-10-27 12:19:20 yuri
|
||||||
|
* GetLocatTime now also native
|
||||||
|
|
||||||
|
Revision 1.35 2003/10/27 11:43:40 yuri
|
||||||
* New set of native functions
|
* New set of native functions
|
||||||
|
|
||||||
Revision 1.34 2003/10/18 16:58:39 hajny
|
Revision 1.34 2003/10/18 16:58:39 hajny
|
||||||
|
Loading…
Reference in New Issue
Block a user