mIRC Home    About    Download    Register    News    Help

Print Thread
#217384 09/01/10 11:32 PM
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
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?


-
Just because it never happened doesn't mean it isn't true.
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
only reason I can think of why that happends is because of a virus 'on-access' scanner


If it ain't broken, don't fix it!
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
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.


-
Just because it never happened doesn't mean it isn't true.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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.

Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
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?




-
Just because it never happened doesn't mean it isn't true.
Joined: Jul 2008
Posts: 236
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
//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.

s00p #217400 10/01/10 09:13 PM
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
"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.


-
Just because it never happened doesn't mean it isn't true.
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
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.


-
Just because it never happened doesn't mean it isn't true.
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
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.

DJ_Sol #217403 10/01/10 11:12 PM
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
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.


-
Just because it never happened doesn't mean it isn't true.
Joined: Jul 2008
Posts: 236
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
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.

Last edited by s00p; 11/01/10 10:58 AM.

Link Copied to Clipboard