aboutsummaryrefslogtreecommitdiff
path: root/src/utiltime.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2016-12-01 11:47:39 +0100
committerWladimir J. van der Laan <[email protected]>2016-12-01 11:47:47 +0100
commitc79e52ad304a02cb66c66cfee49c9b82b458e769 (patch)
treea663bd9df23c6ca75fc6abe0f12da712929ddc7a /src/utiltime.cpp
parentMerge #9226: Remove fNetworkNode and pnodeLocalHost. (diff)
parentMake fStartedNewLine an std::atomic_bool (diff)
downloaddiscoin-c79e52ad304a02cb66c66cfee49c9b82b458e769.tar.xz
discoin-c79e52ad304a02cb66c66cfee49c9b82b458e769.zip
Merge #9230: Fix some benign races in timestamp logging
8b22efb Make fStartedNewLine an std::atomic_bool (Matt Corallo) 507145d Fix race when accessing std::locale::classic() (Matt Corallo)
Diffstat (limited to 'src/utiltime.cpp')
-rw-r--r--src/utiltime.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/utiltime.cpp b/src/utiltime.cpp
index da590f888..51d545ef8 100644
--- a/src/utiltime.cpp
+++ b/src/utiltime.cpp
@@ -74,8 +74,9 @@ void MilliSleep(int64_t n)
std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime)
{
+ static std::locale classic(std::locale::classic());
// std::locale takes ownership of the pointer
- std::locale loc(std::locale::classic(), new boost::posix_time::time_facet(pszFormat));
+ std::locale loc(classic, new boost::posix_time::time_facet(pszFormat));
std::stringstream ss;
ss.imbue(loc);
ss << boost::posix_time::from_time_t(nTime);