Author: aconway
Date: Mon Feb 13 16:18:39 2012
New Revision: 1243583
URL: http://svn.apache.org/viewvc?rev=1243583&view=rev
Log:
QPID-3603: Format the seconds part of high-resolution timestamps.
Hi-res timestamps are now formatted like this: 2012-02-02 17:40:20.236067000
Modified:
qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/log/Logger.cpp
qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/log/Options.cpp
qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/sys/posix/Time.cpp
Modified: qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/log/Logger.cpp
URL:
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/log/Logger.cpp?rev=1243583&r1=1243582&r2=1243583&view=diff
==============================================================================
--- qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/log/Logger.cpp (original)
+++ qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/log/Logger.cpp Mon Feb 13
16:18:39 2012
@@ -83,7 +83,7 @@ void Logger::log(const Statement& s, con
if (flags&HIRES)
qpid::sys::outputHiresNow(os);
else
- qpid::sys::outputFormattedNow(os);
+ qpid::sys::outputFormattedNow(os);
}
if (flags&LEVEL)
os << LevelTraits::name(s.level) << " ";
Modified: qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/log/Options.cpp
URL:
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/log/Options.cpp?rev=1243583&r1=1243582&r2=1243583&view=diff
==============================================================================
--- qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/log/Options.cpp (original)
+++ qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/log/Options.cpp Mon Feb 13
16:18:39 2012
@@ -66,7 +66,7 @@ Options::Options(const std::string& argv
("log-source", optValue(source,"yes|no"), "Include source file:line in
log messages")
("log-thread", optValue(thread,"yes|no"), "Include thread ID in log
messages")
("log-function", optValue(function,"yes|no"), "Include function
signature in log messages")
- ("log-hires-timestamp", optValue(hiresTs,"yes|no"), "Use unformatted
hi-res timestamp in log messages")
+ ("log-hires-timestamp", optValue(hiresTs,"yes|no"), "Use hi-resolution
timestamps in log messages")
("log-prefix", optValue(prefix,"STRING"), "Prefix to append to all log
messages")
;
add(*sinkOptions);
Modified: qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/sys/posix/Time.cpp
URL:
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/sys/posix/Time.cpp?rev=1243583&r1=1243582&r2=1243583&view=diff
==============================================================================
--- qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/sys/posix/Time.cpp (original)
+++ qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/sys/posix/Time.cpp Mon Feb 13
16:18:39 2012
@@ -107,7 +107,9 @@ void outputFormattedNow(std::ostream& o)
void outputHiresNow(std::ostream& o) {
::timespec time;
::clock_gettime(CLOCK_REALTIME, &time);
- o << time.tv_sec << "." << std::setw(9) << std::setfill('0') <<
time.tv_nsec << "s ";
+ ::time_t seconds = time.tv_sec;
+ outputFormattedTime(o, &seconds);
+ o << "." << std::setw(9) << std::setfill('0') << time.tv_nsec << " ";
}
void sleep(int secs) {
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]