mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 07:26:03 -06:00
#1831 SourSimRL : Use millisecs to represent fraction of day
This commit is contained in:
parent
724fb89189
commit
0bbcfb352a
@ -129,10 +129,14 @@ std::vector<QDateTime> RifHdf5Reader::timeSteps() const
|
|||||||
H5::H5File file(fileName.c_str(), H5F_ACC_RDONLY);
|
H5::H5File file(fileName.c_str(), H5F_ACC_RDONLY);
|
||||||
|
|
||||||
double timeStepValue = getDoubleAttribute(file, timeStepGroup, "timestep"); // Assumes only one time step per file
|
double timeStepValue = getDoubleAttribute(file, timeStepGroup, "timestep"); // Assumes only one time step per file
|
||||||
int seconds = timeStepValue * secondsPerDay;
|
int timeStepDays = cvf::Math::floor(timeStepValue);
|
||||||
|
|
||||||
|
double fractionOfDay = timeStepValue - timeStepDays;
|
||||||
|
double milliseconds = fractionOfDay * 24.0 * 60.0 * 60.0 * 1000.0;
|
||||||
|
|
||||||
QDateTime dt = dtInitial;
|
QDateTime dt = dtInitial;
|
||||||
dt = dt.addSecs(seconds);
|
dt = dt.addDays(timeStepDays);
|
||||||
|
dt = dt.addMSecs(milliseconds);
|
||||||
|
|
||||||
times.push_back(dt);
|
times.push_back(dt);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user