fix: TR_TIME_LOCALTIME value in torrent scripts (#5006)

This commit is contained in:
wiz78 2023-02-23 14:18:29 +01:00 committed by GitHub
parent bc34f77624
commit 450e98fd91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -475,10 +475,11 @@ void torrentCallScript(tr_torrent const* tor, std::string const& script)
auto const labels_str = buildLabelsString(tor); auto const labels_str = buildLabelsString(tor);
auto const trackers_str = buildTrackersString(tor); auto const trackers_str = buildTrackersString(tor);
auto const bytes_downloaded_str = std::to_string(tor->downloadedCur + tor->downloadedPrev); 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<std::string_view, std::string_view>{ auto const env = std::map<std::string_view, std::string_view>{
{ "TR_APP_VERSION"sv, SHORT_VERSION_STRING }, { "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_BYTES_DOWNLOADED"sv, bytes_downloaded_str },
{ "TR_TORRENT_DIR"sv, torrent_dir.c_str() }, { "TR_TORRENT_DIR"sv, torrent_dir.c_str() },
{ "TR_TORRENT_HASH"sv, tor->infoHashString() }, { "TR_TORRENT_HASH"sv, tor->infoHashString() },