Time to utc convertions


#1

I did not find a way to convert a local juce::Time to UTC. Would it make sense to add something like the member below?

Time Time::toUTC()
{
time_t secondsSinceEpoch = millisSinceEpoch / 1000;

tm utcTm;
gmtime_r(&secondsSinceEpoch, &utcTm);

int64 utcSecondsSinceEpoch = mktime(&utcTm);

return Time(utcSecondsSinceEpoch * 1000);

}


#2

Surely that’s a complicated way of writing this:

Time Time::toUTC() { return *this; }

?


#3

Ouch. And it seems toMilliseconds() will give me the number of milliseconds since epoch which is exactly what I need.