• 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
(RS) hi-res clock function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(RS) hi-res clock function


  • Subject: (RS) hi-res clock function
  • From: Roland Silver <email@hidden>
  • Date: Wed, 25 Oct 2006 05:48:02 -0600

The following code snippet reveals that the time elapsed between one invocation of [NSDate date] and an immediately following one can be as little as 2 usec (on my Powerbook G4).

A related experiment shows that the resolution of the GNU clock() function on the PowerBook is no less than 16 usec.

Is there a function like clock() that returns time (since some origin) directly to a finer resolution than clock does?

	NSDate *start, *stop;
	start = [NSDate date];
	stop = [NSDate date];
	NSTimeInterval elapsed = [stop timeIntervalSinceDate:start];;
	NSLog(@"elapsed=%g", elapsed);

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: (RS) hi-res clock function
      • From: Shawn Erickson <email@hidden>
    • Re: (RS) hi-res clock function
      • From: Alastair Houghton <email@hidden>
  • Prev by Date: Re: outlets to multiple views (NSView)
  • Next by Date: Re: (RS) hi-res clock function
  • Previous by thread: Re: Cocoa from carbon - cursor tracking issues
  • Next by thread: Re: (RS) hi-res clock function
  • Index(es):
    • Date
    • Thread