From 2f67f299e5b3a07fc99d06cab8da33be1e531df9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 4 Oct 2020 11:26:22 -0400 Subject: [PATCH] correct error messages and make use of utils and fmtlib --- src/timer.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/timer.cpp b/src/timer.cpp index adf143b4ae..f5bc373d7c 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -249,7 +249,6 @@ double Timer::get_timeout_remain() ------------------------------------------------------------------------- */ static const char *timer_style[] = { "off", "loop", "normal", "full" }; static const char *timer_mode[] = { "nosync", "(dummy)", "sync" }; -static const char timer_fmt[] = "New timer settings: style=%s mode=%s timeout=%s\n"; void Timer::modify_params(int narg, char **arg) { @@ -271,15 +270,15 @@ void Timer::modify_params(int narg, char **arg) ++iarg; if (iarg < narg) { _timeout = utils::timespec2seconds(arg[iarg]); - } else error->all(FLERR,"Illegal timers command"); + } else error->all(FLERR,"Illegal timer command"); } else if (strcmp(arg[iarg],"every") == 0) { ++iarg; if (iarg < narg) { _checkfreq = utils::inumeric(FLERR,arg[iarg],false,lmp); if (_checkfreq <= 0) - error->all(FLERR,"Illegal timers command"); - } else error->all(FLERR,"Illegal timers command"); - } else error->all(FLERR,"Illegal timers command"); + error->all(FLERR,"Illegal timer command"); + } else error->all(FLERR,"Illegal timer command"); + } else error->all(FLERR,"Illegal timer command"); ++iarg; } @@ -295,9 +294,8 @@ void Timer::modify_params(int narg, char **arg) strftime(timebuf,32,"%H:%M:%S",tm); } - if (screen) - fprintf(screen,timer_fmt,timer_style[_level],timer_mode[_sync],timebuf); - if (logfile) - fprintf(logfile,timer_fmt,timer_style[_level],timer_mode[_sync],timebuf); + utils::logmesg(lmp,fmt::format("New timer settings: style={} mode={} " + "timeout={}\n",timer_style[_level], + timer_mode[_sync],timebuf); } }