1{
2    This file is part of the Free Pascal Run time library.
3    Copyright (c) 2015 by Florian Klaempfl
4
5    This unit contain procedures specific for an extended pascal compatible mode.
6    It should be platform independent.
7
8    See the file COPYING.FPC, included in this distribution,
9    For details about the copyright.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
15 **********************************************************************}
16
17unit extpas;
18
19  interface
20
21    type
22      TimeStamp = packed record
23        DateValid : Boolean;
24        TimeValid : Boolean;
25        year : Integer;
26        month : 1..12;
27        day : 1..31;
28        hour : 0..23;
29        minute : 0..59;
30        second : 0..59;
31        { implementation specific }
32        second100 : 0..99;
33      end;
34
35    procedure GetTimeStamp(var ts : TimeStamp);
36
37  implementation
38
39    uses
40      dos;
41
42    procedure GetTimeStamp(var ts : TimeStamp);
43      var
44        year1,month1,mday1,wday1,
45        year2,month2,mday2,wday2,
46        hour,minute,second,sec100 : word;
47      begin
48        repeat
49          GetDate(year1,month1,mday1,wday1);
50          GetTime(hour,minute,second,sec100);
51          GetDate(year2,month2,mday2,wday2);
52        { the date may not have changed while we read the time }
53        until (year1=year2) and (month1=month2) and (mday1=mday2);
54        ts.DateValid:=true;
55        ts.TimeValid:=true;
56        ts.year:=year1;
57        ts.month:=month1;
58        ts.day:=mday1;
59        ts.hour:=hour;
60        ts.minute:=minute;
61        ts.second:=second;
62        ts.second100:=sec100;
63      end;
64
65
66end.
67