mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 15:47:51 +02:00
* overloaded gettime functions supporting hsec and msec,usec
This commit is contained in:
parent
6c4b0b264b
commit
1a553942fb
@ -493,7 +493,9 @@ Procedure GetTimeOfDay(var tv:timeval);
|
|||||||
Function GetTimeOfDay:longint;
|
Function GetTimeOfDay:longint;
|
||||||
Procedure EpochToLocal(epoch:longint;var year,month,day,hour,minute,second:Word);
|
Procedure EpochToLocal(epoch:longint;var year,month,day,hour,minute,second:Word);
|
||||||
Function LocalToEpoch(year,month,day,hour,minute,second:Word):Longint;
|
Function LocalToEpoch(year,month,day,hour,minute,second:Word):Longint;
|
||||||
Procedure GetTime(Var Hour,Minute,Second:Word);
|
procedure GetTime(var hour,min,sec,msec,usec:word);
|
||||||
|
procedure GetTime(var hour,min,sec,sec100:word);
|
||||||
|
procedure GetTime(var hour,min,sec:word);
|
||||||
Procedure GetDate(Var Year,Month,Day:Word);
|
Procedure GetDate(Var Year,Month,Day:Word);
|
||||||
Procedure GetDateTime(Var Year,Month,Day,hour,minute,second:Word);
|
Procedure GetDateTime(Var Year,Month,Day,hour,minute,second:Word);
|
||||||
|
|
||||||
@ -1341,24 +1343,50 @@ Begin
|
|||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
Procedure GetTime(Var Hour,Minute,Second:Word);
|
procedure GetTime(var hour,min,sec,msec,usec:word);
|
||||||
{
|
{
|
||||||
Gets the current time, adjusted to local time
|
Gets the current time, adjusted to local time
|
||||||
}
|
}
|
||||||
var
|
var
|
||||||
year,day,month:Word;
|
year,day,month:Word;
|
||||||
Begin
|
t : timeval;
|
||||||
EpochToLocal(GetTimeOfDay,year,month,day,hour,minute,second);
|
begin
|
||||||
End;
|
gettimeofday(t);
|
||||||
|
EpochToLocal(t.sec,year,month,day,hour,min,sec);
|
||||||
|
msec:=t.usec div 1000;
|
||||||
|
usec:=t.usec mod 1000;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure GetTime(var hour,min,sec,sec100:word);
|
||||||
|
{
|
||||||
|
Gets the current time, adjusted to local time
|
||||||
|
}
|
||||||
|
var
|
||||||
|
usec : word;
|
||||||
|
begin
|
||||||
|
gettime(hour,min,sec,sec100,usec);
|
||||||
|
sec100:=sec100 div 10;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Procedure GetTime(Var Hour,Min,Sec:Word);
|
||||||
|
{
|
||||||
|
Gets the current time, adjusted to local time
|
||||||
|
}
|
||||||
|
var
|
||||||
|
msec,usec : Word;
|
||||||
|
Begin
|
||||||
|
gettime(hour,min,sec,msec,usec);
|
||||||
|
End;
|
||||||
|
|
||||||
|
|
||||||
Procedure GetDate(Var Year,Month,Day:Word);
|
Procedure GetDate(Var Year,Month,Day:Word);
|
||||||
{
|
{
|
||||||
Gets the current date, adjusted to local time
|
Gets the current date, adjusted to local time
|
||||||
}
|
}
|
||||||
var
|
var
|
||||||
hour,minute,second : Word;
|
hour,minute,second : word;
|
||||||
Begin
|
Begin
|
||||||
EpochToLocal(GetTimeOfDay,year,month,day,hour,minute,second);
|
EpochToLocal(GetTimeOfDay,year,month,day,hour,minute,second);
|
||||||
End;
|
End;
|
||||||
@ -3055,7 +3083,7 @@ end;
|
|||||||
Function FExpand(Const Path:PathStr):PathStr;
|
Function FExpand(Const Path:PathStr):PathStr;
|
||||||
var
|
var
|
||||||
temp : pathstr;
|
temp : pathstr;
|
||||||
i,j,k : longint;
|
i,j : longint;
|
||||||
p : pchar;
|
p : pchar;
|
||||||
Begin
|
Begin
|
||||||
{Remove eventual drive - doesn't exist in Linux}
|
{Remove eventual drive - doesn't exist in Linux}
|
||||||
@ -3078,8 +3106,10 @@ Begin
|
|||||||
begin
|
begin
|
||||||
if path[i]<>'/' then
|
if path[i]<>'/' then
|
||||||
begin
|
begin
|
||||||
getdir(0,temp);
|
{$I-}
|
||||||
k:=ioresult;
|
getdir(0,temp);
|
||||||
|
{$I+}
|
||||||
|
if ioresult<>0 then;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
inc(i);
|
inc(i);
|
||||||
@ -3787,7 +3817,10 @@ End.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.54 1999-12-01 22:46:59 peter
|
Revision 1.55 1999-12-08 01:03:54 peter
|
||||||
|
* overloaded gettime functions supporting hsec and msec,usec
|
||||||
|
|
||||||
|
Revision 1.54 1999/12/01 22:46:59 peter
|
||||||
+ timezone support
|
+ timezone support
|
||||||
|
|
||||||
Revision 1.53 1999/11/14 21:35:04 peter
|
Revision 1.53 1999/11/14 21:35:04 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user