From c6b51c98fb3f6ea42cc27b64dfb9f37111304578 Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Thu, 7 Sep 2023 15:49:00 +0200 Subject: [PATCH] Ignore invalid points --- Sources/App/configure.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Sources/App/configure.swift b/Sources/App/configure.swift index aec29f8..098d84a 100755 --- a/Sources/App/configure.swift +++ b/Sources/App/configure.swift @@ -136,6 +136,7 @@ private func readElements(from url: URL) throws -> [Timestamped] where T: var result: [Timestamped] = [] var currentIndex = data.startIndex + var skippedValues = 0 while currentIndex < data.endIndex { let startIndexOfTimestamp = currentIndex + byteCountLength guard startIndexOfTimestamp <= data.endIndex else { @@ -159,14 +160,18 @@ private func readElements(from url: URL) throws -> [Timestamped] where T: let timestamp = try decoder.decode(Double.self, from: timestampData) let date = Date(timeIntervalSince1970: timestamp) let elementData = data[currentIndex..