Skip to content

Commit dbc9f17

Browse files
committed
Fix deprecated use of localtime
1 parent d043b28 commit dbc9f17

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎Common/Utils/src/FileFetcher.cxx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <thread>
2424
#include <chrono>
2525
#include <cstdlib>
26+
#include <ctime>
2627
#include <locale>
2728
#include <TGrid.h>
2829
#include <TSystem.h>
@@ -243,8 +244,10 @@ void FileFetcher::cleanup()
243244
const auto systemTime = std::chrono::time_point_cast<std::chrono::system_clock::duration>(
244245
fileTime - fs::file_time_type::clock::now() + std::chrono::system_clock::now());
245246
const auto modificationTime = std::chrono::system_clock::to_time_t(systemTime);
247+
std::tm localTime{};
248+
localtime_r(&modificationTime, &localTime);
246249
const auto size = entry.is_regular_file() ? std::to_string(entry.file_size()) : "-";
247-
LOGP(info, "{:%Y-%m-%d %H:%M:%S} {} {}", fmt::localtime(modificationTime), size, entry.path().filename().string());
250+
LOGP(info, "{:%Y-%m-%d %H:%M:%S} {} {}", localTime, size, entry.path().filename().string());
248251
}
249252
} catch (const std::exception& e) {
250253
LOGP(error, "FileFetcher failed to list scratch directory {}: {}", mCopyDirName, e.what());

0 commit comments

Comments
 (0)