# Time::getCurrentTime() and Sleep

**URL:** <https://forum.juce.com/t/time-getcurrenttime-and-sleep/9388>\
**Category:** MacOSX and iOS\
**Created:** [October 12, 2012, 3:03pm UTC](https://forum.juce.com/t/time-getcurrenttime-and-sleep/9388 "2012-10-12T15:03:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfitzpat](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@jfitzpat](https://forum.juce.com/u/jfitzpat)\
**Post date:** [October 12, 2012, 3:03pm UTC](https://forum.juce.com/t/time-getcurrenttime-and-sleep/9388/1 "2012-10-12T15:03:06Z")

</div>

Haven’t checked on other platforms/versions, but on Mountain Lion, getCurrentTime() loses time during sleep.

getCurrentTime() calls Time (currentTimeMillis())

currentTimeMillis() only calls the underlying OS time calls when first invoked, or when the counter wraps. So, when the millisecond timer is suspended…

I don’t think you want to slow the time call down, so perhaps a call expressly get systemTime? If there is one already and I missed it, sorry.

Alternately, you could make the time system sleep aware.

Sorry, brain is full with something else at the moment - But I wanted to note it while I still remembered it.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [October 13, 2012, 9:56am UTC](https://forum.juce.com/t/time-getcurrenttime-and-sleep/9388/2 "2012-10-13T09:56:32Z")

</div>

Thanks - I do need to look at this, will do asap…
