Better atomicity (not perfect) for RsDdg() and companions

This commit is contained in:
Gioacchino Mazzurco 2020-04-21 18:10:58 +02:00
parent 1cfbfdaf63
commit 2f0b0f48bf
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051

View File

@ -85,6 +85,7 @@ private:
#include <iostream>
#include <chrono>
#include <iomanip>
#include <sstream>
enum class RsLoggerCategories
{
@ -110,11 +111,12 @@ struct t_RsLogger
const auto now = system_clock::now();
const auto sec = time_point_cast<seconds>(now);
const auto msec = duration_cast<milliseconds>(now - sec);
const auto tFill = std::cerr.fill();
return std::cerr << static_cast<char>(CATEGORY) << " "
<< sec.time_since_epoch().count() << "."
<< std::setfill('0') << std::setw(3) << msec.count()
<< std::setfill(tFill) << " " << val;
std::stringstream tstream;
tstream << static_cast<char>(CATEGORY) << " "
<< sec.time_since_epoch().count() << "."
<< std::setfill('0') << std::setw(3) << msec.count()
<< " " << val;
return std::cerr << tstream.str();
}
/// needed for manipulators and things like std::endl