1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
uses DateUtils;
{$R *.dfm}
function Right(st : String;i : integer) : String;
begin
Result := Copy(st,length(st)-i,i);
end;
type TStringsArray = array of string;
function Split(txt: string; delimit: char): TStringsArray;
var
i: integer;
deb: integer;
idx: integer;
begin
i := 1;
deb := 1;
idx := 0;
txt := Trim(txt);
SetLength(Result,0);
while (i < length(txt)) do
begin
if (txt[i] = delimit) then
begin
SetLength(Result, idx +1);
Result[idx] := copy(txt, deb, i - deb);
deb := i;
inc(idx);
end;
inc(i);
end;
if i <> deb then
begin
SetLength(Result, idx +1);
Result[idx] := copy(txt, deb, length(txt));
end;
end;
function DateAdd(interval : string;Quantity: Int64;ADate: TDateTime): TDateTime;
begin
if ((length(interval) < 2) and (trim(interval) <> '')) Then
begin
Case interval[1] of
'd': Result := IncDay(ADate,Quantity);
//'y': Result := IncYear(ADate,Quantity);
'h': Result := IncHour(ADate,Quantity);
'n': Result := IncMinute(ADate,Quantity);
'm': Result := IncMonth(ADate,Quantity);
'q': Result := IncYear(ADate,Quantity);
's': Result := IncSecond(ADate,Quantity);
//'w': Result := IncSecond(ADate,Quantity);
end;
end
else
if interval ='ww' Then
Result := IncWeek(ADate,Quantity)
else
if interval ='yyyy' Then;
Result := IncYear(ADate,Quantity);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
FES : String[16];
FES_TIME : String[4];
Datum : TDateTime;
t : Integer;
//c : Integer;
szHelp : String;
//szHelp2 : String;
v : Variant;
l : Longint;
szFilename : String;
Stream : TFileStream;
begin
szFilename := ExtractFilepath(Application.ExeName) + '\Jugl.db';
Stream := TFileStream.Create(szFilename,fmOpenRead);
While Not(Stream.Size < Stream.Position) do
begin
Stream.Read(FES,length(FES));
If (Stream.Size < Stream.Position) Then
Exit;
Stream.Read(FES_TIME,length(FES_TIME));
szHelp := '';
For t := 1 To 4 do
szHelp := szHelp + Right('00'+inttostr(ord(Copy(FES_TIME,t,1)[1])),2);
l := StrToInt('$'+ szHelp) ;
Datum := DateAdd('s',l,EncodeDate(1970,01,01)) ;
szHelp := '';
For t := 1 To 16 do
szHelp := szHelp + Right('00'+inttostr(ord(copy(FES, t, 1)[1])), 2);
end;
// List1.AddItem(FormatDateTime('hh:mm:ss dd.mm.yyyy',Datum) + ' -> ' + szHelp ;
List1.Items.Add(FormatDateTime('hh:mm:ss dd.mm.yyyy',Datum) + ' -> ' + szHelp );
end;
Stream.Free;
end;
end. |