Browse Source

Fixed an ISO8601 time parsing bug

tags/2021-05-28
tpoole 8 years ago
parent
commit
60b4b7cfe5
1 changed files with 13 additions and 1 deletions
  1. +13
    -1
      modules/juce_core/time/juce_Time.cpp

+ 13
- 1
modules/juce_core/time/juce_Time.cpp View File

@@ -506,7 +506,19 @@ Time Time::fromISO8601 (StringRef iso) noexcept
if (minutes < 0)
return {};
milliseconds = (int) (1000.0 * CharacterFunctions::readDoubleValue (t));
auto seconds = parseFixedSizeIntAndSkip (t, 2, 0);
if (seconds < 0)
return {};
if (*t == '.')
{
++t;
milliseconds = parseFixedSizeIntAndSkip (t, 3, 0);
if (milliseconds < 0)
return {};
}
milliseconds += 1000 * seconds;
}
const juce_wchar nextChar = t.getAndAdvance();


Loading…
Cancel
Save