>>> I tried to find the access time of a file using stat() function.
>>> but the following C code in windows vc.net 2003 always give
[quoted text clipped - 4 lines]
> tried unde pure NTFS windows XP SP 2,
> the same problem. the access time is never changed.
> Have you used any registry tricks to improve NTFS performance? Not
> generating short filenames and not updating access times are two favorites
> for saving cycles.
Not sure which registry value to look for not generating short filenames
or not updating access time?
are you able to run the following code successfully in windows xp
with different access time?
#include <stdio.h>
#include <sys/stat.h>
int main() {
struct stat sbuf;
char *name="c:\\windows\\win.ini";
FILE *fd;
char result[100];
if(!stat(name, &sbuf) )
{
printf("atime = %d\n", sbuf.st_atime);
}
fd = fopen(name, "r");
if(!stat(name, &sbuf) )
{
printf("atime = %d\n", sbuf.st_atime);
}
fread(result, 3,1, fd);
if(!stat(name, &sbuf) )
{
printf("atime = %d\n", sbuf.st_atime);
}
fclose(fd);
if(!stat(name, &sbuf) )
{
printf("atime = %d\n", sbuf.st_atime);
}
return 0;
}
Ben Voigt - 10 Nov 2006 16:35 GMT
>> Have you used any registry tricks to improve NTFS performance? Not
>> generating short filenames and not updating access times are two
[quoted text clipped - 5 lines]
> are you able to run the following code successfully in windows xp
> with different access time?
Yes and no:
atime = 1163171213
atime = 1163171213
atime = 1163171213
atime = 1163175949
Second run:
atime = 1163175949
atime = 1163175949
atime = 1163175949
atime = 1163175949
See also
http://technet2.microsoft.com/WindowsServer/en/library/8cc5891d-bf8e-4164-862d-d
ac5418c59481033.mspx?mfr=true
and search for "Last Access Time".
Indeed, _fstat works considerably better, changing once per second.