Repository: xbmc/xbmc
File: xbmc/cores/VideoPlayer/Edl.cpp (C++)

Code before:
        std::vector<std::string> fieldParts = StringUtils::Split(strFields[i], '.');
        if (fieldParts.size() == 1) // No ms
        {
          editStartEnd[i] = std::chrono::duration_cast<std::chrono::milliseconds>(
              std::chrono::seconds(StringUtils::TimeStringToSeconds(fieldParts[0])));
        }
        else if (fieldParts.size() == 2) // Has ms. Everything after the dot (.) is ms
        {
          /*
           * Have to pad or truncate the ms portion to 3 characters before converting to ms.
           */
          if (fieldParts[1].length() == 1)
          {
            fieldParts[1] = fieldParts[1] + "00";
          }
          else if (fieldParts[1].length() == 2)
          {
            fieldParts[1] = fieldParts[1] + "0";
          }
          else if (fieldParts[1].length() > 3)
          {
            fieldParts[1] = fieldParts[1].substr(0, 3);
          }
          editStartEnd[i] = std::chrono::duration_cast<std::chrono::milliseconds>(
              std::chrono::seconds(StringUtils::TimeStringToSeconds(fieldParts[0])));
          editStartEnd[i] += std::chrono::milliseconds(std::atoi(fieldParts[1].c_str()));
        }
        else
        {
          bError = true;
          continue;
        }
      }
      else if (strFields[i][0] == '#') // #12345 format for frame number
      {
        if (fps > 0.0f)
        {
          std::chrono::duration<double, std::ratio<1>> durationInSeconds{
              std::atol(strFields[i].substr(1).c_str()) / fps};
          editStartEnd[i] =
              std::chrono::duration_cast<std::chrono::milliseconds>(durationInSeconds);
        }
        else
        {
          CLog::Log(LOGERROR,
                    "Edl::ReadEdl - Frame number not supported in EDL files when frame rate is "
                    "unavailable (ts) - supplied frame number: {}",
                    strFields[i].substr(1));
          return false;
        }
      }

Review comment (suggestion):
Could use `std::stoi` to avoid the `c_str` call but may have to handle the possible exception.

Code after:
      if (strFields[i].find(':') != std::string::npos) // HH:MM:SS.sss format
      {
        std::vector<std::string> fieldParts = StringUtils::Split(strFields[i], '.');
        if (fieldParts.size() == 1) // No ms
        {
          editStartEnd[i] = std::chrono::duration_cast<std::chrono::milliseconds>(
              std::chrono::seconds(StringUtils::TimeStringToSeconds(fieldParts[0])));
        }
        else if (fieldParts.size() == 2) // Has ms. Everything after the dot (.) is ms
        {
          /*
           * Have to pad or truncate the ms portion to 3 characters before converting to ms.
           */
          if (fieldParts[1].length() == 1)
          {
            fieldParts[1] = fieldParts[1] + "00";
          }
          else if (fieldParts[1].length() == 2)
          {
            fieldParts[1] = fieldParts[1] + "0";
          }
          else if (fieldParts[1].length() > 3)
          {
            fieldParts[1] = fieldParts[1].substr(0, 3);
          }
          int additionalMs{0};
          editStartEnd[i] = std::chrono::duration_cast<std::chrono::milliseconds>(
              std::chrono::seconds(StringUtils::TimeStringToSeconds(fieldParts[0])));
          std::from_chars(fieldParts[1].data(), fieldParts[1].data() + fieldParts[1].size(),
                          additionalMs);
          editStartEnd[i] += std::chrono::milliseconds(additionalMs);
        }
        else
        {
          bError = true;
          continue;
        }
      }
      else if (strFields[i][0] == '#') // #12345 format for frame number
      {
        if (fps > 0.0f)
        {
          std::chrono::duration<double, std::ratio<1>> durationInSeconds{
              std::atol(strFields[i].substr(1).c_str()) / fps};
          editStartEnd[i] =
              std::chrono::duration_cast<std::chrono::milliseconds>(durationInSeconds);
        }
        else
        {
          CLog::Log(LOGERROR,
                    "Edl::ReadEdl - Frame number not supported in EDL files when frame rate is "