From afc9e4453a3683a516ac80c785115e1189a4e0e5 Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Tue, 21 Jun 2016 11:25:05 +0800 Subject: [PATCH] get current date time. --- opm/core/simulator/SimulatorTimer.cpp | 5 +++++ opm/core/simulator/SimulatorTimer.hpp | 3 +++ 2 files changed, 8 insertions(+) diff --git a/opm/core/simulator/SimulatorTimer.cpp b/opm/core/simulator/SimulatorTimer.cpp index c5a58749..66e8e2ff 100644 --- a/opm/core/simulator/SimulatorTimer.cpp +++ b/opm/core/simulator/SimulatorTimer.cpp @@ -108,6 +108,11 @@ namespace Opm } + boost::posix_time::ptime SimulatorTimer::currentDateTime() const + { + return startDateTime() + boost::posix_time::seconds( (int) simulationTimeElapsed()); + } + /// Total time. double SimulatorTimer::totalTime() const { diff --git a/opm/core/simulator/SimulatorTimer.hpp b/opm/core/simulator/SimulatorTimer.hpp index 882f13a1..4db76093 100644 --- a/opm/core/simulator/SimulatorTimer.hpp +++ b/opm/core/simulator/SimulatorTimer.hpp @@ -85,6 +85,9 @@ namespace Opm /// Return start date of simulation boost::posix_time::ptime startDateTime() const; + /// Return current date. + boost::posix_time::ptime currentDateTime() const; + /// Set total time. /// This is primarily intended for multi-epoch schedules, /// where a timer for a given epoch does not have