C (25/304)

From:Jack York
Date:04 Aug 2000 at 14:22:08
Subject:Re: Comparing dates

Hello Oliver

On 04-Aug-00, Oliver Roberts wrote:
> Hi Jack,
>
> On 04-Aug-00 01:01:43 BST, Jack York wrote:
>
>> I am trying to compare the date a file was written to todays date.
>> The code for todays date works fine but for the file, the date
>> is totally off (see below). The file used for this test was created
>> right before the program was ran so the dates should have been
>> the same, or close to it. Can anyone see where I am going wrong
>> or if there is a better way of doing this?
>
> I think you'll find the problem is the ExAll call. It should be:
>
> ExAll(obj_lock, buffer, SIZE_PATH, ED_DATE, control);

Thanks, that took care of that problem. :)

> Presumably you have a good reason for using ExAll() - i.e. the code that
> you sent is in a loop and actually scanning a dir contents. However,
> you should be using ExNext() somewhere, IIRC. If you're just checking
> a single file, then you should probably be using Examine() or ExamineFH()
> instead.

It is in a loop scanning the directory since there could be more than one
file I'm looking at. The only reason I am using ExAll is because it is the
newer function. I thought it was the better way to go although I haven't
used any of them before so I'm only guessing.
>
> As for a better way... You could maybe use timer.device/GetSysTime() to
> obtain the system time in seconds, rather than use DateStamp() and
> calculating the number of seconds from that. And if the format of the
> date output is not particularly important then you could use DateToStr()
> instead.

It looked like DateStamp was a lot easier. Wouldn't using the timer
device to get the current time add a lot of extra code?

Jack