Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help using TSearch

37 views
Skip to first unread message

Charles Rutledge

unread,
Oct 1, 1995, 3:00:00 AM10/1/95
to
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:

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

rutl...@hiwaay.net


The Green Meddler

unread,
Oct 2, 1995, 3:00:00 AM10/2/95
to
this is a non-trivial problem. Dos has its own wacky format for
file times and dates. a friend of mine wrote time/date manipulation
code for dos in old TP and he sweated bullets getting it right! AFAIK,
Delphi doesn't help here. my advice is to look for code on the old
pascal site at garbo.uwasa.fi or on compuserve. The older TP code
to munch the numbers will still work fine in delphi.
>Thanks,
>Charlie
>
>rutl...@hiwaay.net
>


--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ 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! _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

Ray Lischner

unread,
Oct 2, 1995, 3:00:00 AM10/2/95
to
On 1 Oct 1995 15:34:02 GMT, Charles Rutledge <rutl...@hiwaay.net>
wrote:

>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


Matthew Gessner

unread,
Oct 3, 1995, 3:00:00 AM10/3/95
to
li...@tempest-sw.com (Ray Lischner) wrote:

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)


Luke Webber

unread,
Oct 3, 1995, 3:00:00 AM10/3/95
to
>Charles Rutledge <rutl...@hiwaay.net> wrote:
>>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:
>>
>>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?

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 *

Slobodan Celenkovic

unread,
Oct 4, 1995, 3:00:00 AM10/4/95
to comp.lang.pascal.delphi.misc
FileDateToDateTime Function

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


0 new messages