Use std::chrono::system_clock with 1/1000 second resolution

This commit is contained in:
Joakim Hove
2021-02-25 20:46:51 +01:00
parent 6f15765f53
commit 74ca0d12e0
7 changed files with 17 additions and 11 deletions

View File

@@ -283,7 +283,7 @@ std::size_t packSize(const RestartValue& data, Dune::MPIHelper::MPICommunicator
+ packSize(data.extra, comm);
}
std::size_t packSize(const std::chrono::system_clock::time_point&, Dune::MPIHelper::MPICommunicator comm)
std::size_t packSize(const Opm::time_point&, Dune::MPIHelper::MPICommunicator comm)
{
std::time_t tp;
return packSize(tp, comm);
@@ -576,10 +576,10 @@ void pack(const RestartValue& data, std::vector<char>& buffer, int& position,
pack(data.extra, buffer, position, comm);
}
void pack(const std::chrono::system_clock::time_point& data, std::vector<char>& buffer, int& position,
void pack(const Opm::time_point& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(std::chrono::system_clock::to_time_t(data), buffer, position, comm);
pack(Opm::TimeService::to_time_t(data), buffer, position, comm);
}
@@ -887,12 +887,12 @@ void unpack(RestartValue& data, std::vector<char>& buffer, int& position,
unpack(data.extra, buffer, position, comm);
}
void unpack(std::chrono::system_clock::time_point& data, std::vector<char>& buffer, int& position,
void unpack(Opm::time_point& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::time_t tp;
unpack(tp, buffer, position, comm);
data = std::chrono::system_clock::from_time_t(tp);
data = Opm::TimeService::from_time_t(tp);
}

View File

@@ -27,6 +27,7 @@
#include <opm/output/eclipse/EclipseIO.hpp>
#include <opm/output/eclipse/Summary.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/State.hpp>
#include <opm/common/utility/TimeService.hpp>
#include <dune/common/parallel/mpihelper.hh>
@@ -321,7 +322,7 @@ ADD_PACK_PROTOTYPES(data::WellRates)
ADD_PACK_PROTOTYPES(RestartKey)
ADD_PACK_PROTOTYPES(RestartValue)
ADD_PACK_PROTOTYPES(std::string)
ADD_PACK_PROTOTYPES(std::chrono::system_clock::time_point)
ADD_PACK_PROTOTYPES(Opm::time_point)
} // end namespace Mpi