summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-02-14 16:11:42 +0000
committerAlan Conway <aconway@apache.org>2012-02-14 16:11:42 +0000
commit54e443809e09b8cc7ae05fdf02e80775a1bb71e6 (patch)
tree67283d85e61727c5c54136ebb3aa528af8b77bf7
parentaa0ab1ef1778a2c97f38806aa4f4feef92e93a46 (diff)
downloadqpid-python-54e443809e09b8cc7ae05fdf02e80775a1bb71e6.tar.gz
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 git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid-3603-6@1244102 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/log/Logger.cpp2
-rw-r--r--qpid/cpp/src/qpid/log/Options.cpp2
-rw-r--r--qpid/cpp/src/qpid/sys/posix/Time.cpp4
3 files changed, 5 insertions, 3 deletions
diff --git a/qpid/cpp/src/qpid/log/Logger.cpp b/qpid/cpp/src/qpid/log/Logger.cpp
index 8c995a5c32..c4ce025547 100644
--- a/qpid/cpp/src/qpid/log/Logger.cpp
+++ b/qpid/cpp/src/qpid/log/Logger.cpp
@@ -83,7 +83,7 @@ void Logger::log(const Statement& s, const std::string& msg) {
if (flags&HIRES)
qpid::sys::outputHiresNow(os);
else
- qpid::sys::outputFormattedNow(os);
+ qpid::sys::outputFormattedNow(os);
}
if (flags&LEVEL)
os << LevelTraits::name(s.level) << " ";
diff --git a/qpid/cpp/src/qpid/log/Options.cpp b/qpid/cpp/src/qpid/log/Options.cpp
index 0001d00bdf..1259244297 100644
--- a/qpid/cpp/src/qpid/log/Options.cpp
+++ b/qpid/cpp/src/qpid/log/Options.cpp
@@ -66,7 +66,7 @@ Options::Options(const std::string& argv0_, const std::string& name_) :
("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);
diff --git a/qpid/cpp/src/qpid/sys/posix/Time.cpp b/qpid/cpp/src/qpid/sys/posix/Time.cpp
index dee393f4bf..272c6c21a5 100644
--- a/qpid/cpp/src/qpid/sys/posix/Time.cpp
+++ b/qpid/cpp/src/qpid/sys/posix/Time.cpp
@@ -114,7 +114,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) {