Re: needed Time for a method
Re: needed Time for a method
- Subject: Re: needed Time for a method
- From: David Remahl <email@hidden>
- Date: Sat, 21 Sep 2002 01:34:59 +0200
>
Hi,
>
>
I want to know the time how long a method takes and I found for that
>
>
(NSTimeInterval)timestamp
>
>
but I can't use it because I am to stupid. How I get the value from
>
this?
>
>
double startStamp;
>
[startStamp timestamp];
>
>
doesn't work :-((
>
>
has timestamp smaller values than seconds?
>
>
You do you have other ways to check speed of a method?
>
>
thanks for help.
You can use NSDate:
NSDate *start = [NSDate date];
// do stuff
usleep(1000);
NSLog(@"Time passed (in seconds, with decimals): %f", [[NSDate date]
timeIntervalSinceDate:start]);
The reason your code is not working, is that double is not an object but a C
variable. It does not respond to messages. The timestamp method you found is
related to NSEvent, and used to determine the time at which an event
occurred.
/ Rgds, David
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.