mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
fix date for large time steps
This commit is contained in:
parent
edb2c4abb2
commit
06878a8ca8
@ -115,15 +115,6 @@ namespace Opm
|
||||
}
|
||||
|
||||
|
||||
boost::posix_time::ptime SimulatorTimer::currentDateTime() const
|
||||
{
|
||||
// Boost uses only 32 bit long for seconds, but 64 bit for milliseconds.
|
||||
// As a workaround for very large times we just use milliseconds.
|
||||
// The cast is necessary because boost::posix_time::milliseconds requires
|
||||
// an integer argument.
|
||||
return startDateTime() + boost::posix_time::milliseconds(static_cast<long long>(simulationTimeElapsed() / Opm::prefix::milli));
|
||||
}
|
||||
|
||||
/// Total time.
|
||||
double SimulatorTimer::totalTime() const
|
||||
{
|
||||
|
@ -90,9 +90,6 @@ namespace Opm
|
||||
/// Return start date of simulation
|
||||
boost::posix_time::ptime startDateTime() const override;
|
||||
|
||||
/// Return current date.
|
||||
boost::posix_time::ptime currentDateTime() const override;
|
||||
|
||||
/// Set total time.
|
||||
/// This is primarily intended for multi-epoch schedules,
|
||||
/// where a timer for a given epoch does not have
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/simulators/timestepping/SimulatorTimerInterface.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Units/Units.hpp>
|
||||
#include <boost/date_time/posix_time/conversion.hpp>
|
||||
|
||||
namespace Opm
|
||||
@ -27,8 +27,11 @@ namespace Opm
|
||||
|
||||
boost::posix_time::ptime SimulatorTimerInterface::currentDateTime() const
|
||||
{
|
||||
return startDateTime() + boost::posix_time::seconds( (int) simulationTimeElapsed());
|
||||
//boost::posix_time::ptime(startDate()) + boost::posix_time::seconds( (int) simulationTimeElapsed());
|
||||
// Boost uses only 32 bit long for seconds, but 64 bit for milliseconds.
|
||||
// As a workaround for very large times we just use milliseconds.
|
||||
// The cast is necessary because boost::posix_time::milliseconds requires
|
||||
// an integer argument.
|
||||
return startDateTime() + boost::posix_time::milliseconds(static_cast<long long>(simulationTimeElapsed() / Opm::prefix::milli));
|
||||
}
|
||||
|
||||
time_t SimulatorTimerInterface::currentPosixTime() const
|
||||
|
Loading…
Reference in New Issue
Block a user