• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: needed Time for a method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: needed Time for a method


  • Subject: Re: needed Time for a method
  • From: Claudius Sailer <email@hidden>
  • Date: Sat, 21 Sep 2002 10:38:20 +0200

Am Samstag, 21.09.02 um 01:34 Uhr schrieb David Remahl:

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.

I tested NSDate before I found timestamp, but I always got seconds as result. Thats not fine enough. Now I found the bug in my way.

I used

NSLog(@"Time passed (in seconds, with decimals): %d", [[NSDate date] timeIntervalSinceDate:start]);

now I know why I only get seconds ;-))

Thanks for help


Claudius
_______________________________________________
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.

References: 
 >Re: needed Time for a method (From: David Remahl <email@hidden>)

  • Prev by Date: Re: runModalForWindow allows window switching
  • Next by Date: initWithWindowRef versus initWithMenuRef
  • Previous by thread: Re: needed Time for a method
  • Next by thread: Re: needed Time for a method
  • Index(es):
    • Date
    • Thread