Skip to content

Commit

Permalink
Fix datarace localtime ChronoUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio3rs committed Jun 28, 2023
1 parent b30ae1c commit ea083c7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/ChronoUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ class ChronoUtils {
{
std::array<char, 32> buf{};

std::tm tmLocal{};

size_t strft_res_sz =
strftime(buf.data(), buf.size(), "%Y/%m/%d %H:%M:%S.",
std::localtime(&tt));
localtime_r(&tt, &tmLocal));

str.reserve(28);
str.append(buf.data(), strft_res_sz);
Expand Down

0 comments on commit ea083c7

Please sign in to comment.