Re: getting last accessed date
Re: getting last accessed date
- Subject: Re: getting last accessed date
- From: "Rick C." <email@hidden>
- Date: Fri, 08 Jul 2011 16:54:03 +0800
Sorry about that no I'm on Mac OS I was just sending the email from my iPhone :-)
Ok I double-checked and I think I am getting the same results as you are. But iconForFile does not modify the Last Opened date that shows in Finder. So the question is how do I get that besides using the spotlight metadata?
On Jul 8, 2011, at 3:24 PM, Stephen J. Butler wrote:
> On Fri, Jul 8, 2011 at 1:53 AM, Rick C. <email@hidden> wrote:
>> Well I am using iconForFile if I remember correctly. Since I'm on the iPhone let me double-check everything you all have suggested and I'll post back. Thanks again!
>
> Didn't know you were on iOS. But yes, I would expect iconForFile: to
> modify the atime.
>
>> On Jul 8, 2011, at 1:52 PM, "Stephen J. Butler" <email@hidden> wrote:
>>
>>> 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
>>
> _______________________________________________
>
> 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
_______________________________________________
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