diff --git a/include/openmc/output.h b/include/openmc/output.h index e396c07d8..793c9b727 100644 --- a/include/openmc/output.h +++ b/include/openmc/output.h @@ -4,6 +4,7 @@ #ifndef OPENMC_OUTPUT_H #define OPENMC_OUTPUT_H +#include namespace openmc { @@ -16,6 +17,14 @@ namespace openmc { void header(const char* msg, int level); + +//============================================================================== +//! Retrieve a time stamp with the format "yyyy-mm-dd hh:mm:ss" +//! +//============================================================================== + +std::string time_stamp(); + //============================================================================== //! Display information regarding cell overlap checking. //============================================================================== diff --git a/src/output.cpp b/src/output.cpp index 6a3abeed6..0eb6b204c 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -5,6 +5,7 @@ #include // for setw #include #include +#include #include "openmc/cell.h" #include "openmc/geometry.h" @@ -39,6 +40,18 @@ header(const char* msg, int level) { } } +std::string time_stamp() +{ + int base_year = 1990; + std::stringstream ts; + std::time_t t = std::time(0); // get time now + std::tm* now = std::localtime(&t); + ts << now->tm_year + base_year << "-" << now->tm_mon + << "-" << now->tm_mday << " " << now->tm_hour + << ":" << now->tm_min << ":" << now->tm_sec; + return ts.str(); +} + //============================================================================== void print_overlap_check() { diff --git a/src/plot.cpp b/src/plot.cpp index ea0fda83f..afb927252 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -1,5 +1,4 @@ #include -#include #include "openmc/plot.h" #include "openmc/constants.h" @@ -14,6 +13,7 @@ #include "openmc/output.h" #include "openmc/hdf5_interface.h" #include "openmc/random_lcg.h" +#include "openmc/output.h" namespace openmc { @@ -28,16 +28,6 @@ const int NULLRGB[3] = {0, 0, 0}; // RUN_PLOT controls the logic for making one or many plots //=============================================================================== - std::string time_stamp() - { - std::stringstream ts; - std::time_t t = std::time(0); // get time now - std::tm* now = std::localtime(&t); - ts << now->tm_year + 1990 << "-" << now->tm_mon - << "-" << now->tm_mday << " " << now->tm_hour - << ":" << now->tm_min << ":" << now->tm_sec; - return ts.str(); - } int openmc_plot_geometry_c() { int err;