|
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; |