diff --git a/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp b/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp index 846f4ebdbc6b..96c0bbfb9f00 100644 --- a/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp +++ b/Code/Mantid/Framework/Kernel/src/TimeSeriesProperty.cpp @@ -484,26 +484,14 @@ namespace Mantid if (isGood) { - //Start of a good section - if (centre) - start = t - tol; - else - start = t; + // Start of a good section. Subtract tolerance from the time if boundaries are centred. + start = centre ? t - tol : t; } else { - //End of the good section - if (numgood == 1 || centre ) - { - // If there was only one point with the value, or values represent bin centres, - // use the last good time, + the tolerance, as the end time - stop = lastTime + tol; - } - else - { - // At least 2 good values for left boundary aligned logs. Save the end time. - stop = t; - } + // End of the good section. Add tolerance to the LAST GOOD time if boundaries are centred. + // Otherwise, use the first 'bad' time. + stop = centre ? lastTime + tol : t; split.push_back( SplittingInterval(start, stop, 0) ); //Reset the number of good ones, for next time numgood = 0; diff --git a/Code/Mantid/Framework/Kernel/test/TimeSeriesPropertyTest.h b/Code/Mantid/Framework/Kernel/test/TimeSeriesPropertyTest.h index 449fdeaabe40..5fa39eea1651 100644 --- a/Code/Mantid/Framework/Kernel/test/TimeSeriesPropertyTest.h +++ b/Code/Mantid/Framework/Kernel/test/TimeSeriesPropertyTest.h @@ -373,7 +373,7 @@ class TimeSeriesPropertyTest : public CxxTest::TestSuite s = splitter[0]; t = DateAndTime("2007-11-30T16:17:10"); TS_ASSERT_DELTA( s.start(), t, 1e-3); - t = DateAndTime("2007-11-30T16:17:11"); + t = DateAndTime("2007-11-30T16:17:20"); TS_ASSERT_DELTA( s.stop(), t, 1e-3); s = splitter[1];