diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/TimeMap.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/TimeMap.cpp index 3c44dcaf0..76bc74b6a 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/TimeMap.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/TimeMap.cpp @@ -191,8 +191,7 @@ namespace { const auto &item = TSTEPKeyword.getRecord(0).getItem(0); for (size_t itemIndex = 0; itemIndex < item.size(); itemIndex++) { - const double days = item.get(itemIndex); - const int64_t seconds = static_cast(days * 24 * 60 * 60); + const int64_t seconds = static_cast(item.getSIDouble(itemIndex)); addTStep(seconds); } } diff --git a/tests/parser/TimeMapTest.cpp b/tests/parser/TimeMapTest.cpp index d05c781ad..709d38185 100644 --- a/tests/parser/TimeMapTest.cpp +++ b/tests/parser/TimeMapTest.cpp @@ -353,6 +353,35 @@ BOOST_AUTO_TEST_CASE(initTimestepsLongStep) { } +BOOST_AUTO_TEST_CASE(TimestepsLabUnit) { + const char *deckData = + "START\n" + " 1 JAN 1983 /\n" + "\n" + "LAB\n" + " \n" + "TSTEP\n" + " 24*10 /\n"; + + Opm::Parser parser; + auto deck = parser.parseString(deckData); + const Opm::TimeMap tmap(deck); + + /*deckData timesteps: + 0 1 jan 1983 START + 1 11 jan 1983*/ + + const std::time_t tEnd = tmap.getEndTime(); + + int year, day, month; + + util_set_date_values_utc(tEnd, &day, &month, &year); + BOOST_CHECK_EQUAL(year, 1983); + BOOST_CHECK_EQUAL(month, 1); + BOOST_CHECK_EQUAL(day, 11); +} + + BOOST_AUTO_TEST_CASE(initTimestepsDistantDates) { const char *deckData = "START\n"