test/test_translate_song: use std::to_string()
This commit is contained in:
@@ -157,11 +157,8 @@ ToString(const Tag &tag)
|
|||||||
{
|
{
|
||||||
std::string result;
|
std::string result;
|
||||||
|
|
||||||
if (!tag.duration.IsNegative()) {
|
if (!tag.duration.IsNegative())
|
||||||
char buffer[64];
|
result.append(std::to_string(tag.duration.ToMS()));
|
||||||
sprintf(buffer, "%d", tag.duration.ToMS());
|
|
||||||
result.append(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto &item : tag) {
|
for (const auto &item : tag) {
|
||||||
result.push_back('|');
|
result.push_back('|');
|
||||||
@@ -179,27 +176,18 @@ ToString(const DetachedSong &song)
|
|||||||
std::string result = song.GetURI();
|
std::string result = song.GetURI();
|
||||||
result.push_back('|');
|
result.push_back('|');
|
||||||
|
|
||||||
char buffer[64];
|
if (!IsNegative(song.GetLastModified()))
|
||||||
|
result.append(std::to_string(std::chrono::system_clock::to_time_t(song.GetLastModified())));
|
||||||
if (!IsNegative(song.GetLastModified())) {
|
|
||||||
sprintf(buffer, "%lu",
|
|
||||||
(unsigned long)std::chrono::system_clock::to_time_t(song.GetLastModified()));
|
|
||||||
result.append(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
result.push_back('|');
|
result.push_back('|');
|
||||||
|
|
||||||
if (song.GetStartTime().IsPositive()) {
|
if (song.GetStartTime().IsPositive())
|
||||||
sprintf(buffer, "%u", song.GetStartTime().ToMS());
|
result.append(std::to_string(song.GetStartTime().ToMS()));
|
||||||
result.append(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
result.push_back('-');
|
result.push_back('-');
|
||||||
|
|
||||||
if (song.GetEndTime().IsPositive()) {
|
if (song.GetEndTime().IsPositive())
|
||||||
sprintf(buffer, "%u", song.GetEndTime().ToMS());
|
result.append(std::to_string(song.GetEndTime().ToMS()));
|
||||||
result.append(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
result.push_back('|');
|
result.push_back('|');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user