private static void SkipOutdatedRecords(Stream stream, Encoding encoding, DateTime startTime)
{
if (stream.Length - stream.Position < 16 * 1024)
return;
var pos = stream.Position;
while (true)
{
ReadLine(stream, encoding); // skip line - it can be incomplete
var line = ReadLine(stream, encoding);
if (line == null)
break;
var lineTime = GetLineTime(line);
if (lineTime > startTime)
break;
pos = stream.Position;
var newPos = stream.Position + (stream.Length - stream.Position) / 2;
stream.Position = newPos;
}
stream.Position = pos;
}