tango-controls/cppTango

log4tango: Remove LOG4TANGO_HAVE_INT64_T with std::chrono

Closed this issue · 1 comments

t-b commented

struct MillisSinceEpochComponent : public PatternLayout::PatternComponent {
virtual void append(std::ostringstream& out, const LoggingEvent& event) {
#ifdef LOG4TANGO_HAVE_INT64_T
int64_t t = event.timestamp.get_seconds() -
TimeStamp::get_start_time().get_seconds();
t *= 1000;
t += event.timestamp.get_milliseconds() -
TimeStamp::get_start_time().get_milliseconds();
out << t;
#else
double t = event.timestamp.get_seconds() -
TimeStamp::get_start_time().get_seconds();
t *= 1000;
t += event.timestamp.get_milliseconds() -
TimeStamp::get_start_time().get_milliseconds();
out << std::setiosflags(std::ios::fixed)
<< std::setprecision(0) << t;

Hi @t-b
I see you mentioned this issue in #759 but can't see where and if you plan to address this. Thus I did a quick PR in #794. Let's see if it passes the tests. The PR changes API and ABI of LoggingEvent but I think users are not supposed to access that directly.