1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Refactored some demo code to avoid a problem when using String::formatted when Strings are UTF-32

This commit is contained in:
jules 2016-05-06 15:02:00 +01:00
parent dbf915603d
commit 09d6409644

View file

@ -136,14 +136,14 @@ void JuceDemoPluginAudioProcessorEditor::timerCallback()
// quick-and-dirty function to format a timecode string
static String timeToTimecodeString (double seconds)
{
const int millisecs = roundToInt (std::abs (seconds * 1000.0));
const int millisecs = roundToInt (seconds * 1000.0);
const int absMillisecs = std::abs (millisecs);
return String::formatted ("%s%02d:%02d:%02d.%03d",
seconds < 0 ? "-" : "",
return String::formatted ("%02d:%02d:%02d.%03d",
millisecs / 360000,
(millisecs / 60000) % 60,
(millisecs / 1000) % 60,
millisecs % 1000);
(absMillisecs / 60000) % 60,
(absMillisecs / 1000) % 60,
absMillisecs % 1000);
}
// quick-and-dirty function to format a bars/beats string