From: | Colin Wenzel |
Date: | 24 Aug 2000 at 13:52:01 |
Subject: | Re: Comparing Dates |
On 24-Aug-00, Jack York wrote:
> Hello,
> I am trying to compare the date a file was created with a date
> I input. I convert the inputed date to a struct DateStamp and I
> compare it against the struct DateStamp in the FileInfoBlock
> obtained from the file lock by using the CompareDates
> function. If the comparison is for one date being before or
> after the other, it works fine. But when I try to compare for
> equality it fails. I printed out the individual fields and found
> the failure occurs when comparing the ds_Tick field. But if I
> convert both of those struct DateStamps to struct ClockData
> and print the results I get identical times. Is it possible to
> compare for equality between two dates using DateStamps?
> If so, how. If not, is there a way around this? The way I am
> doing it now (converting to ClockData) works but the
> function is within a loop and the time it takes (since I am
> really comparing many files) increases more than I would
> prefer.
> Jack
I think it may be a math conversion / rounding problem.....
I had a problem similar to this, I didn't spend a lot of time on it
but I believe I found that only EVEN ticks work with CompareDate(),
I don't know why, or even if that was actually the problem,
but I just ANDED the ds_Ticks of both datestamps with 0xFFFFFFFC
stamp.ds_Tick &= 0xFFFFFFFC;
That round it down to the nearest 4 ticks.
Or, you could just set the ds_Ticks field to 2 in both datestamps
before comparing with CompareDates().
The worst that can happen with this, is that it won't see a
date change of less than 1 minute difference.
Regards
Colin Wenzel. Australia.
EMAIL: colstv@hotkey.net.au
URL: http://www.hotkey.net.au/~colstv/
ICQ: 17608330
AMIGA: 4000T, 68060/50, 150Mb RAM,
OS 3.5, Spectrum Gfx Card.
Need an Image Generator For CATV ??
http://connect.to/products
_________________________________________