mIRC Homepage
Posted By: lerpicus File access time - 09/01/10 11:32 PM
From mirc help
Code:
$file(filename)

Returns information about the specified file. 

Properties: size, ctime, mtime, atime, shortfn, longfn, attr
$file(mirc.exe).size          returns the file size
$file(mirc.exe).ctime          returns creation time
$file(mirc.exe).mtime          returns last modification time
$file(mirc.exe).atime          returns last access time

It seems to me that the atime property returns the same time as the mtime property.

Is this a feature or a bug?
Posted By: Wims Re: File access time - 09/01/10 11:49 PM
It's not a bug or a feature, the access time and modification time are two different things, $file($mircexe).atime and .mtime are different in my test
Posted By: Doqnach Re: File access time - 10/01/10 01:30 AM
only reason I can think of why that happends is because of a virus 'on-access' scanner
Posted By: lerpicus Re: File access time - 10/01/10 05:06 AM
wims, can you please show me how you tested the atime and mtime properties?

I have tested them on files within $mircdir and c:\, with mirc version 6.35 an 6.17, with anti-virus enabled and disabled.
ie
Code:
echo -s $file(test.txt).atime
echo -s $file(c:\test.txt).atime


I create the file, modify it and close it, then read it and close it again. atime seems to change at the first read access, but then not change again with subsequent reads till I modify it.
Posted By: RusselB Re: File access time - 10/01/10 05:30 AM
the file in your first example uses the file in the mIRC operational directory. Use
Code:
//echo -a $mircdir
to see where this directory is located.

The file in your second example uses the file in your C root directory.

Comparing the .ctime & .atime values of two different files is not a fair comparison of those two time values.
Posted By: lerpicus Re: File access time - 10/01/10 07:28 AM
Russell, the point of my last post was to show that I had tried test.txt in $mircdir and test.txt in the root directory, creating each file and accessing each file separately, and subsequently checking the atime property. It was to see if mirc was treating files in $mircdir differently from those in other directories. Sorry if it wasn't clear.

Can somebody who says that they get a different response from .atime and .mtime please show me their method?


Posted By: s00p Re: File access time - 10/01/10 09:14 AM
//echo -- $file(c:\windows\system32\cmd.exe).mtime
Quote:
1208135534


//echo -- $file(c:\windows\system32\cmd.exe).atime
Quote:
1263105298


File creation, modification and access are different. Creation falls under modification which falls under access. However, access does not necessarily mean modification (the file could be accessed in read-only mode) and modification does not necessarily mean creation (the file could already exist).

Please ask such questions as this in a forum that is relevant to your operating system in the future.
Posted By: lerpicus Re: File access time - 10/01/10 09:13 PM
"File creation, modification and access are different." -- Really?

"Please ask such questions as this in a forum that is relevant to your operating system in the future. " --- My operating system is Windows .. does mirc run on Linux?

echo -s $file(mirc.ini).atime
Code:
1263156594

echo -s $read(mirc.ini)
Code:
n7=#Chataway

echo -s $file(mirc.ini).atime
Code:
1263156594


As you can see, subsequent file access is not altering the access time returned by the atime property.
Posted By: lerpicus Re: File access time - 10/01/10 09:47 PM
Ok. Just wrote a dll in Delphi to return file access time. It behaves in the same manner as mirc's atime property behaves for me.

Still can't see why, though. I think that to read a file you must access it, and if you access it the access time would be updated.

Maybe it is being buffered somewhere, and the disk file is not being accessed unless the buffer changes.... who knows.
Posted By: DJ_Sol Re: File access time - 10/01/10 09:56 PM
Originally Posted By: lerpicus
"File creation, modification and access are different." -- Really?

"Please ask such questions as this in a forum that is relevant to your operating system in the future. " --- My operating system is Windows .. does mirc run on Linux?


mIRC runs on Linux using the WINE interface. And feel free to ask any questions concerning mirc & your OS here.
Posted By: lerpicus Re: File access time - 10/01/10 11:12 PM
DJ_Sol, Thank you. At times one wonders at the superciliousness of those assigned by the gods to help lesser mortals.

On a lighter note, This website has provided the following information
Quote:
Resolution of file last accessed date is 1 hour for NTFS and 1 day for FAT. This means that only access hour or day will be recorded for this file property, skipping access minutes or hours accordingly.]


An answer at last!

Thanks to all who tried to help.
Posted By: s00p Re: File access time - 11/01/10 10:54 AM
That's due to implementation -- atime may be modified at the time when the underlying fopen() or fclose() is called. I'm not sure which is the case, but either:
i. mIRC only needs to call fopen() once to read multiple times, so multiple reads won't result in multiple fopen()'s.
ii. mIRC has not yet called fclose().

I'd tell you to do your freaking research, but you've already found a site which states the following:
Quote:
Any viewing, copying or moving of the documents, images and other files automatically alters last accessed date stamp of the file.

Thus, contradicting yourself and backing my statement. At least you would have learnt something. Hopefully, your lesson learnt was to do your research before you say things that may be stupid.
© mIRC Discussion Forums