             
             result.padEnd(header.sampleSize, samplesPerSecond: header.samplesPerSecond, gapValue: gapValue, until: sensorData.startTime)
             let resultEndTime2 = result.endTime(header.sampleSize, samplesPerSecond: header.samplesPerSecond)
-            if resultEndTime2 =~= range.end {
-                return ContinuousSensorDataArray(header: header, sensorData: result)
-            }
-            
             result.append(samples: sensorData.samplesTrimmedTo(end: range.end, sampleSize: header.sampleSize, samplesPerSecond: header.samplesPerSecond))
         }
         

        var (j, result) = firstSensorData!
        for i in (j + 1)..<sensorDatas.count {
            let resultEndTime = result.endTime(header.sampleSize, samplesPerSecond: header.samplesPerSecond)
            if resultEndTime > range.end {
                return ContinuousSensorDataArray(header: header, sensorData: result.trimmedTo(end: range.end, sampleSize: header.sampleSize, samplesPerSecond: header.samplesPerSecond))
            }
            if resultEndTime =~= range.end {
                return ContinuousSensorDataArray(header: header, sensorData: result)
            }
            
            let sensorData = sensorDatas[i]
            

        return SensorData(startTime: startTime, samples: samplesTrimmedTo(end: time, sampleSize: sampleSize, samplesPerSecond: samplesPerSecond))
    }
    
    /*
    ///
    /// Computes slice of samples that fall within the given time range, 
