title: elapsedRealtime analogue for Object.wait
body: <p>I used <code>Object.wait(timeout)</code> in my android app service. But it does not count time spent in "deep sleep mode". I use AlarmManager to wakeup my app periodically, so waking from deep sleep is not the problem. The problem is that <code>wait(60000)</code> not terminates after 100 seconds of deep sleep.</p>
  
  <p>As i read on <a href="http://developer.android.com/intl/ru/reference/android/os/SystemClock.html" rel="nofollow">SystemClock</a> help page, <code>object.wait</code> uses <a href="http://developer.android.com/reference/android/os/SystemClock.html#uptimeMillis%28%29" rel="nofollow">uptimeMillis()</a> method, which stops counting in deep sleep. For my needs it will be better to use <a href="http://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime%28%29" rel="nofollow">elapsedRealtime()</a>. </p>
  
  <p>How can i implement an analogue of <code>Object.wait(timeout)</code> but using <a href="http://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime%28%29" rel="nofollow">elapsedRealtime</a> method? Or what can i use instead?</p>
  
  <hr>
  
  <p>One of the tasks i use this method for is to generate "ping" packet to send via network when no other packets are in queue for some amount of time.</p>