home *** CD-ROM | disk | FTP | other *** search
- {BEGINNING OF FDTTM.INC}
- (* Functions to return strings of FileCreationDate and FileCreationTime
- of an open file. Must be called with a valid file handle *)
- type
- String16 = String[16];
-
- Function FDate(var f): string16;
-
- var
- handle: Integer absolute f; {File handle is the first word of a file's FIB}
- regs: record
- case integer of
- 1: (AX, BX, CX, DX, BP, SI, DI, DS, ES, Flags: Integer);
- 2: (AL, AH, BL, BH, CL, CH, DL, DH: Byte)
- end;
- date: integer;
- year,month,day : string16;
-
- begin
- regs.AX := $5700; {DOS function to get file date from handle}
- regs.BX := handle;
- MsDos(regs);
- if ( (regs.flags and $0001) <> 0) then { not a valid handle}
- begin { return a null string}
- Fdate :='';
- exit;
- end;
- date := regs.DX;
-
- Str((Hi(Date) shr 1)+80, Year);
- Str(((Date shr 5) and 15):2, Month);
- Str((Date and 31):2, Day);
- If Day[1] = ' '
- Then Day[1] := '0';
-
- FDate := Month + '-' + Day + '-' + Year;
-
- end; {FDate}
-
-
- Function FTime(var f): string16;
-
- var
- handle: Integer absolute f; {File handle is the first word of a file's FIB}
- regs: record
- case Integer of
- 1: (AX, BX, CX, DX, BP, SI, DI, DS, ES, Flags: Integer);
- 2: (AL, AH, BL, BH, CL, CH, DL, DH: Byte)
- end;
-
- Time, Hour, Minute: Integer;
- Hr,Min: String16;
-
- Begin
-
- regs.AX := $5700; {DOS function to get file time from handle}
- regs.BX := handle;
- MsDos(regs);
- if ( (regs.flags and $0001) <> 0) then { not a valid handle}
- begin { return a null string}
- FTime :='';
- exit;
- end;
- Time := regs.CX;
- Hour := Hi(Time) shr 3;
- Minute := (Time shr 5) and 63;
-
- Str(Hour:2, Hr);
- Str(Minute:2, Min);
- If Min[1] = ' '
- Then Min[1] := '0';
-
- FTime := Hr + ':' + Min ;
-
- end; {FTime}
- {END OF FDTTM.INC}