# Time::getCurrentTime() problem

**URL:** <https://forum.juce.com/t/time-getcurrenttime-problem/6573>\
**Category:** General JUCE discussion\
**Created:** [March 15, 2011, 2:27pm UTC](https://forum.juce.com/t/time-getcurrenttime-problem/6573 "2011-03-15T14:27:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gillesda](https://avatars.discourse-cdn.com/v4/letter/g/d07c76/32.png) [@gillesda](https://forum.juce.com/u/gillesda)\
**Post date:** [March 15, 2011, 2:27pm UTC](https://forum.juce.com/t/time-getcurrenttime-problem/6573/1 "2011-03-15T14:27:58Z")

</div>

Hi forum,

I have a question about the juce::Time class, especially the static getCurrentTime routine.

Is it normal that I always get the same output from it during the execution of my program?

When I print out  
Time::getCurrentTime().toString(true, true, true, true) at the beginning of the main function, and at the end (which could be minutes later), I always get the same time. Shouldn’t the current time get updated?

I’m using version 1.51

Gilles

---

<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:** [March 15, 2011, 2:47pm UTC](https://forum.juce.com/t/time-getcurrenttime-problem/6573/2 "2011-03-15T14:47:29Z")

</div>

If that method was broken then no apps would run at all. But you say “your main function”, so my guess is that you’ve probably just not initialised the library properly, or something simple like that.

---

<div class="post-metadata">

**Author:** ![gillesda](https://avatars.discourse-cdn.com/v4/letter/g/d07c76/32.png) [@gillesda](https://forum.juce.com/u/gillesda)\
**Post date:** [March 15, 2011, 3:07pm UTC](https://forum.juce.com/t/time-getcurrenttime-problem/6573/3 "2011-03-15T15:07:38Z")

</div>

Ok, thanks for the reply. If I do the same thing in one of the example projects, the time is displayed correctly. So I must be making a mistake in including the juce lib to my project. The odd thing is that everything else works fine (using other juce classes). I’ll figure it out.

---

<div class="post-metadata">

**Author:** ![gillesda](https://avatars.discourse-cdn.com/v4/letter/g/d07c76/32.png) [@gillesda](https://forum.juce.com/u/gillesda)\
**Post date:** [March 15, 2011, 3:17pm UTC](https://forum.juce.com/t/time-getcurrenttime-problem/6573/4 "2011-03-15T15:17:38Z")

</div>

I didn’t call initialiseJuce\_NonGUI(); from my application. Now the getCurrentTime() method returns the current time! There is still an offset, but i’ll figure it out.
