public void ClearDataOlderThan(TimeSpan span) { if (Timestamps.Count == 0) { return; } var currentTimestamp = Timestamps.Last(); var numToSkip = Timestamps.FindIndex(t => t + span >= currentTimestamp); //Log.Debug(_tag, $"At {currentTimestamp}, clearing out {numToSkip} data points, keeping as of {Timestamps.Skip(numToSkip).First()}."); //Provider.Deactivate(); AllowDataUpdates = false; LoggedData = LoggedData.Skip(numToSkip).ToList(); Intervals = Intervals.Skip(numToSkip).ToList(); Timestamps = Timestamps.Skip(numToSkip).ToList(); AllowDataUpdates = true; //Provider.Activate(); }