Measuring and displaying time

The JUCE Time class provides a cross-platform way to specify, measure, and format date and time information in a human-readable fashion. Internally, the Time class stores a value in milliseconds relative to midnight on 1st January 1970. To create a Time object that represents the current time, use Time::getCurrentTime() like the following:

Time now = Time::getCurrentTime();

To bypass the creation of the Time object, you can access the millisecond counter as a 64-bit value directly:

int64 now = Time::currentTimeMillis();

The Time class also provides access to a 32-bit millisecond counter that measures time since system startup:

uint32 now = Time::getMillisecondCounter();

The important point to note about Time::getMillisecondCounter() ...

Get Getting Started With JUCE now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.