From 3cce002fb9a39bd0cfc492e632eb3805db130462 Mon Sep 17 00:00:00 2001 From: Sam Jenkins <s.jenkins@stfc.ac.uk> Date: Wed, 12 Dec 2018 12:53:51 +0000 Subject: [PATCH] Re #23103 updated Icat3Helper based on review --- Framework/ICat/src/ICat3/ICat3Helper.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Framework/ICat/src/ICat3/ICat3Helper.cpp b/Framework/ICat/src/ICat3/ICat3Helper.cpp index 759ee33f05c..1213f6fdf2c 100644 --- a/Framework/ICat/src/ICat3/ICat3Helper.cpp +++ b/Framework/ICat/src/ICat3/ICat3Helper.cpp @@ -190,16 +190,16 @@ void CICatHelper::saveInvestigationIncludesResponse( savetoTableWorkspace((*datafile_citr)->location, t); // File creation Time. - std::unique_ptr<std::string> creationtime = nullptr; - if ((*datafile_citr)->datafileCreateTime != nullptr) { - time_t crtime = *(*datafile_citr)->datafileCreateTime; - char temp[25]; - strftime(temp, 25, "%Y-%b-%d %H:%M:%S", localtime(&crtime)); - std::string ftime(temp); - creationtime = std::make_unique<std::string>(); - creationtime->assign(ftime); + if ((*datafile_citr)->datafileCreateTime) { + const static std::string format("%Y-%b-%d %H:%M:%S"); + std::string creationTime; + creationTime.resize(format.size()); + const time_t crtime = *(*datafile_citr)->datafileCreateTime; + strftime(const_cast<char *>(creationTime.data()), creationTime.size(),format.data(), + localtime(&crtime)); + savetoTableWorkspace(creationTime.data(), t); } - savetoTableWorkspace(creationtime.get(), t); + // savetoTableWorkspace((*datafile_citr)->id, t); -- GitLab