TSearch = Record
Fill: array[1..21] of byte;
Attr: byte;
Time: LongInt;
Size: LongInt;
Name: string[12];
end;
Time is defined as the Time Stamp of the file and as a LonInt.
I have tried all of the Date/Time functions and only get garbage.
Does anyone know what Time means here and how to retrieve the
Date/Time Stamp for the file?
Thanks,
Charlie
--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ Green Meddler kilg...@tde.com Nathan F. Wallace _/
_/ http://www.webcom.com/~kilgalen/welcome.html _/
_/ http://www.webcom.com/~kilgalen/nerelon.html _/
_/ C.I.U.P.K.C. Software -- Unleashing the Power! _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
>I have to build a utility to scan a series of subdirectories to build a file
>containing file information. FindFirst() and FindNext() seem to work
>fine with some minor problems. However, here is the problem:
...
>Time is defined as the Time Stamp of the file and as a LonInt.
>I have tried all of the Date/Time functions and only get garbage.
>Does anyone know what Time means here and how to retrieve the
>Date/Time Stamp for the file?
Call FileDateToDateTime to convert the Time field to a TDateTime.
--
Ray Lischner (li...@tempest-sw.com)
Tempest Software, Corvallis, Oregon, USA
I realize that Ray's solution of calling FileDateToDateTime is much
simpler, BUT I do remember a piece of code from a *long* time ago that I
wrote based on information from Brown & Kyle's _PC_Interrupts_ that
*JUST SO HAPPENS* to match the exact format in the VCL source code for
FileDateToDateTime!
Basically, CX is the file's time and DX is the file's date, and I guess
they'd put CX in the upper 32-bits and DX in the lower 32-bits as
follows:
CX =
15-11 hours (0-23)
10-5 minutes
4-0 seconds/2
DX =
15-9 year - 1980
8-5 month
4-0 day
Thanks to Ralf Brown and Jim Kyle for the information!
I checked the VCL source code and they do a bunch of bitwise
manipluations that exactly match all this.
Matt
---
Matthew Gessner
Aristar Software Development, Akron, OH
mges...@aristar.com (work)
mges...@mcs.kent.edu (school)
The method I use is to get the FileGetDate function followed by the
FileDateToDateTime function.
Luke
--
Luke Webber
* Note: The opinions expressed by Luke Webber are in no way supported *
* by his employers, Luke Webber Consulting Services *
See Also File management routines
Unit
SysUtils
Declaration
function FileDateToDateTime(FileDate: Longint): TDateTime;
Description
FileDateToDateTime converts a DOS date-and-time value to a TDateTime
value. The FileAge, FileGetDate, and FileSetDate routines
operate on DOS date-and-time values, and the Time field of a TSearchRec
used by the FindFirst and FindNext functions contains a
DOS date-and-time value.
For example:
FileDateToDateTime( FileAge( FName )) -> file's timestamp as TDateTime