is the NSTimer monotonic timer

Hi, I have a question, is the NSTimer monotonic timer or wall clock?

Replies

Being switched to the background is only relevant insofar as it allows your app to be suspended and the CPU to sleep. In this question you’ve specified that the CPU won’t sleep (“and the iPhone is running”) but you haven’t specified whether the app is eligible for suspension or not. There’s no way to answer your question without that detail.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

thank you for you reply:


Now consider follow sequence :

  1. Your app schedules a timer for time Tx.
  2. The user presses the Sleep/Wake button. This causes your app to move to the background, shortly after which it’s suspended.
  3. There’s nothing else keeping the CPU awake, so it sleeps at time T1.
  4. At time T2, where T2 > Tx, the user presses the Home button, which wakes the CPU.
  5. Shortly thereafter they unlock the device, which resumes your app.


In this case, can the timer fire after Tx + T2 - T1?

thank you for you reply:


Now consider follow sequence :

  1. Your app schedules a timer for time Tx.
  2. The user presses the Sleep/Wake button. This causes your app to move to the background, shortly after which it’s suspended.
  3. There’s nothing else keeping the CPU awake, so it sleeps at time T1.
  4. At time T2, where T2 > Tx, the user presses the Home button, which wakes the CPU.
  5. Shortly thereafter they unlock the device, which resumes your app.


In this case, can the timer fire after Tx + T2 - T1?