BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
BaseUtils::System Namespace Reference

Description

System call wrappers.

Functions

std::string getCurrentDateAndTime ()
 
std::string getenv (const std::string &name)
 Returns environment variable. More...
 

Function Documentation

◆ getCurrentDateAndTime()

std::string BaseUtils::System::getCurrentDateAndTime ( )

Definition at line 22 of file SysUtils.cpp.

23 {
24  using clock = std::chrono::system_clock;
25 
26  std::stringstream output;
27  std::time_t current_time = clock::to_time_t(clock::now());
28  output << std::put_time(std::gmtime(&current_time), "%Y-%b-%d %T");
29  return output.str();
30 }

◆ getenv()

std::string BaseUtils::System::getenv ( const std::string &  name)

Returns environment variable.

Definition at line 32 of file SysUtils.cpp.

33 {
34  if (char* c = std::getenv(name.c_str()))
35  return c;
36  return "";
37 }
std::string getenv(const std::string &name)
Returns environment variable.
Definition: SysUtils.cpp:32

Referenced by SimulationOptions::SimulationOptions(), and BaseUtils::Python::pythonRuntimeInfo().