From c0086ec150d7617d386a029c39c58a758ef1ba35 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 4 Jul 2016 10:48:57 -0400 Subject: [PATCH] Datafile: sort lines in ascending order before writes --- src/Datafile.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Datafile.cpp b/src/Datafile.cpp index 9988be69..3db31109 100644 --- a/src/Datafile.cpp +++ b/src/Datafile.cpp @@ -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');