From 450e98fd912170306a4a18c9d12d82582003465d Mon Sep 17 00:00:00 2001 From: wiz78 Date: Thu, 23 Feb 2023 14:18:29 +0100 Subject: [PATCH] fix: TR_TIME_LOCALTIME value in torrent scripts (#5006) --- libtransmission/torrent.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libtransmission/torrent.cc b/libtransmission/torrent.cc index 675f0ea0f..9a3c911bc 100644 --- a/libtransmission/torrent.cc +++ b/libtransmission/torrent.cc @@ -475,10 +475,11 @@ void torrentCallScript(tr_torrent const* tor, std::string const& script) auto const labels_str = buildLabelsString(tor); auto const trackers_str = buildTrackersString(tor); auto const bytes_downloaded_str = std::to_string(tor->downloadedCur + tor->downloadedPrev); + auto const localtime_str = fmt::format("{:%a %b %d %T %Y%n}", fmt::localtime(tr_time())); auto const env = std::map{ { "TR_APP_VERSION"sv, SHORT_VERSION_STRING }, - { "TR_TIME_LOCALTIME"sv, fmt::format("{:%a %b %d %T %Y%n}", fmt::localtime(tr_time())) }, + { "TR_TIME_LOCALTIME"sv, localtime_str }, { "TR_TORRENT_BYTES_DOWNLOADED"sv, bytes_downloaded_str }, { "TR_TORRENT_DIR"sv, torrent_dir.c_str() }, { "TR_TORRENT_HASH"sv, tor->infoHashString() },