From d2cd425ad0fd757cf4940a8a69a0abad05dc4d25 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 7 Nov 2024 11:38:58 +0100 Subject: [PATCH] 11867 Do not assume that the first reported time step is initial time step --- .../FileInterface/RifEclipseOutputFileTools.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp index 06a234a61f..f7af8534ae 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp @@ -260,7 +260,10 @@ void RifEclipseOutputFileTools::timeSteps( const ecl_file_type* ecl_file, int dayValue = cvf::Math::floor( dayDoubleValue ); if ( useStartOfSimulationDate ) { - reportDateTime = reportDateTime.addDays( dayValue ); + // Do not assume the first day value is zero. Adjust the day value to be relative to the first day value + // https://github.com/OPM/ResInsight/issues/11867 + const int adjustedDayValue = dayValue - dayValues.front(); + reportDateTime = reportDateTime.addDays( adjustedDayValue ); } double dayFraction = dayDoubleValue - dayValue;