Skip to content
Snippets Groups Projects
Commit 56ed4541 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Use a more C++11 way to compute file's age

C++20 was a bit to much for older compilers (clang-11 and g++-10)
parent ec83bba6
No related branches found
No related tags found
1 merge request!199Integrate checkpointing
...@@ -152,14 +152,13 @@ CoreModule::CoreModule() : BuiltinModule(true) ...@@ -152,14 +152,13 @@ CoreModule::CoreModule() : BuiltinModule(true)
bool has_stop_file = false; bool has_stop_file = false;
if (parallel::rank() == 0) { if (parallel::rank() == 0) {
std::filesystem::path stop_file("STOP"); std::filesystem::path stop_file("stop");
if (std::filesystem::exists(stop_file)) { if (std::filesystem::exists(stop_file)) {
const double elapse_time = ExecutionStatManager::getInstance().getElapseTime(); const double elapse_time = ExecutionStatManager::getInstance().getElapseTime();
const double stop_file_age = std::chrono::duration_cast<std::chrono::seconds>( const double stop_file_age = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now() - std::filesystem::file_time_type::clock::now() -
std::chrono::clock_cast<std::chrono::system_clock>( std::filesystem::last_write_time(stop_file))
std::filesystem::last_write_time(stop_file)))
.count(); .count();
has_stop_file = elapse_time > stop_file_age; has_stop_file = elapse_time > stop_file_age;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment