C (22/304)

From:Oliver Roberts
Date:04 Aug 2000 at 09:34:55
Subject:Re: Comparing dates

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);

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.

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.



*Oliver Roberts* - software developer & web designer
http://www.oliver-roberts.co.uk/ - ICQ: 34640231
/oliver@futaura.co.uk/ | /oliver.roberts@iname.com/


PlayStation Amiga mailing list ==> http://www.egroups.com/group/psxamiga/