• 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
Elapsed time vs sleep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Elapsed time vs sleep


  • Subject: Elapsed time vs sleep
  • From: Matt Gough <email@hidden>
  • Date: Mon, 26 Jul 2010 09:56:49 +0100

I need to calculate (with an accuracy of 0.1 of a second) a real-time time interval. This interval should:

1. Not be affected by whether the system has been put to sleep and woken up while timing. (i.e If I start the timer then sleep the Mac for an hour and wake it up again, my interval should be just over 60 minutes)
2. Not be affected by changes to the wall clock. (i.e If I start the timer, leave it for an hour and then set the wall clock back to the start time, my interval should be just over 60 minutes and not zero)

Up to now, I have been using mach_absolute_time (which satisfies condition 2), but had not noticed that it could not satisfy condition 1. There are several other higher level versions (i.e Uptime, Microseconds), but they all seem to call down to mach_absolute_time.

Obviously all the wall-clock based based (NSDate date], CFAbsoluteTimeGetCurrent) are also out of bounds due to condition 2.

Have I missed something obvious, or is this just not doable?

Thanks

Matt Gough_______________________________________________

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

  • Follow-Ups:
    • Re: Elapsed time vs sleep
      • From: Charlie Dickman <email@hidden>
  • Prev by Date: Core data images
  • Next by Date: Re: Core Data conflict detection
  • Previous by thread: Re: Core data images
  • Next by thread: Re: Elapsed time vs sleep
  • Index(es):
    • Date
    • Thread