Request: juce::Time( double )


I’m probably approaching this the wrong way, but i’m hoping to be able to create some ISO 8601 timestamps using Time::getMillisecondCounterHiRes(); There’s no simple way to create a Time object using the output of Time::getMillisecondCounterHiRes() and then be able to call Time::toISO8601()

Ideally, something like this:

juce::String s = Time(Time::getMillisecondCounterHiRes()).toISO8601(true);

I did see this static method tho:

static int64 Time::secondsToHighResolutionTicks(double 	seconds)

are we supposed to do something like this:

auto s = Time( Time::secondsToHighResolutionTicks( Time::getMillisecondCounterHiRes() * 1000 ) ).toISO8601(true);


just to update this. So, it’s not so much a request, but more that I’m trying to figure out how to combine my midi recording scheme here: MidiMessageSequence -> MidiFile question with timestamps

this was the solution i came up with:

MainContentComponent::MainContentComponent(const Time& s)
    sessionID = s;
    DBG( sessionID.toISO8601(true) );
    start_time_hi_res = Time::getMillisecondCounterHiRes() ;
    startTimer(5 * 1000 ); // 5 seconds
    setSize (600, 400);

void MainContentComponent::timerCallback() {
    auto th = Time::getMillisecondCounterHiRes();
    RelativeTime r( (th - start_time_hi_res) / 1000 );
    auto i = sessionID + r;
    DBG( i.toISO8601(true) );