>I know using that I can get the date and time of a file using GetFTime
>or the appropriate Dos Call.
>GetFtime returns a longint with the information of the date and time. I
>can use the Unpack procedure to translate this information.
>My question is, what is the format of that longint returned? How can I,
>without using unpack, know the date and time... For example, how can I
>know if GetFtime returns me 50198?
>(I know that if I use the Dos Call $2F, I can get the DTA address and
>from there access the time from the date. But again, what do those bytes
>mean? how can I translate them?)
>If anyone one knows this, I would appreciate some help... It's curiosity
>mostly, since I can just use the unpack procedure.
You could use a TypeCast, a variant record, or an absolute
variable to allow treating the DTA as a tSearchRec, then use
UnpackTime. This technique would give you the info you want and
you still wouldn't have to be concerned with the packed format.
From the MS/DOS Encyclopedia:
INT 21h - Function 57h - Get/Set File Date/Time returns date in DX
and time in CX.
Time: CX = Bits 0-4 Number of Seconds div 2
5-10 Minutes 0..59
11-15 Hours 0..23
Date: DX = Bits 0-4 Day of Month 1..31
5-8 Month 1..12 (January=1, ...)
9-15 Year minus 1980
The above is also listed under DOS FindFirst/FindNext, Functions
4Eh/4Fh, which lists Time at offset 16h and Date at offset 18h
within the DTA.
You can experiment to be certain, but my guess is the longint used
by TP is formed from DX:CX (DX high word) which agrees with
treating offset 16h of the searchrec as a longint.
I've used the fact that DOS appears not to check values when
setting or retrieving the date/time of a file to stamp a file with
a value that would indicate that it hasn't been altered outside of
a particular program. For example, setting seconds to a value of
30 or 31, (1Eh..$1Fh) would be out-of-range at 60 or 62 seconds,
would not appear on normal directory listings, but would be reset
if the file was altered. Ex. Time := (Time and $FFFFFFE0) or $1F