• 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: capturing user reaction times in msecs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: capturing user reaction times in msecs


  • Subject: Re: capturing user reaction times in msecs
  • From: Nir Soffer <email@hidden>
  • Date: Tue, 19 Dec 2006 22:16:58 +0200


On Dec 19, 2006, at 20:12, David Duncan wrote:

UInt64 startTime = UnsignedWideToUInt64(AbsoluteToNanoseconds (UpTime()));
... do your thing...
UInt64 endTime = UnsignedWideToUInt64(AbsoluteToNanoseconds(UpTime ()));


UInt64 elapsedTime = (endTime - startTime); // elapsed time in nanoseconds

You will get slightly more accurate timing with

AbsoluteTime startTime = UpTime();
... do your thing...
AbsoluteTime endTime = UpTime();

UInt64 elapsedTime = UnsignedWideToUInt64(AbsoluteToNanoseconds (SubAbsoluteFromAbsolute(endTime, startTime)));

Or simpler:

Duration milliseconds = AbsoluteDeltaToDuration(startTime, endTime);
// For short durations (< 35 minutes), returns negative value in microseconds
if (milliseconds < 0)
milliseconds /= -1000;



Best Regards,

Nir Soffer

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >Re: capturing user reaction times in msecs (From: julia Cline <email@hidden>)
 >Re: Re: capturing user reaction times in msecs (From: "Shawn Erickson" <email@hidden>)
 >Re: capturing user reaction times in msecs (From: David Duncan <email@hidden>)

  • Prev by Date: Re: Launching an About box.
  • Next by Date: Re: Launching an About box.
  • Previous by thread: Re: capturing user reaction times in msecs
  • Next by thread: Re: capturing user reaction times in msecs
  • Index(es):
    • Date
    • Thread