Re: getting last accessed date
Re: getting last accessed date
- Subject: Re: getting last accessed date
- From: "Stephen J. Butler" <email@hidden>
- Date: Fri, 08 Jul 2011 00:52:13 -0500
On Fri, Jul 8, 2011 at 12:31 AM, Scott Ribe <email@hidden> wrote:
> On Jul 7, 2011, at 11:19 PM, Rick C. wrote:
>
>> One more note, seems in terminal "stat aFile" works so I suppose I could use nstask to do this as well?
>
> It does seem odd that the two would produce different results...
They don't, at least not in my test. For all six loops of a given file
this code gives the same output:
#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h>
#import <Foundation/Foundation.h>
int main( int argc, char **argv )
{
struct stat st;
int i;
for (i = 0; i < 3; ++i)
{
if (stat( argv[1], &st ) != 0)
return 1;
printf( "%s #%d atime = %d\n", argv[1], i, st.st_atimespec.tv_sec );
sleep( 10 );
}
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *file = [NSString stringWithUTF8String:argv[1]];
for (i = 0; i < 3; ++i)
{
if (stat( [file fileSystemRepresentation], &st ) != 0)
return 1;
printf( "%s #%d atime = %d\n", argv[1], i, st.st_atimespec.tv_sec );
sleep( 10 );
}
[pool drain];
return 0;
}
I was testing the Obj-C version just in case fileSystemRepresentation
was in some odd way changing the atime.
I think something else in your code is going wrong. Are you asking
Launch Services for an icon or anything like that?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden