Datafile: sort lines in ascending order before writes

This commit is contained in:
Paul Beckingham 2016-07-04 10:48:57 -04:00
parent 44e5dd7b84
commit c0086ec150

View file

@ -135,6 +135,9 @@ void Datafile::commit ()
_file.truncate ();
_file.append (std::string ("")); // Seek to EOF.
// Sort the intervals by ascending start time.
std::sort (_lines.begin (), _lines.end ());
// Write out all the lines.
for (auto& line : _lines)
_file.write_raw (line + '\n');