diff options
author | Alan Conway <aconway@apache.org> | 2012-02-17 14:16:28 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2012-02-17 14:16:28 +0000 |
commit | 4800595bf72e72843c6125e3f6d37562cb27ebc6 (patch) | |
tree | 5f409f3c5354b89f6fb8b43932b629d49741adf1 | |
parent | f3c2015578b6688bdbd7aa9379c88e2461b4c06d (diff) | |
download | qpid-python-4800595bf72e72843c6125e3f6d37562cb27ebc6.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-7@1245549 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/log/Logger.cpp | 2 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/log/Options.cpp | 2 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/sys/posix/Time.cpp | 4 |
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 427abea0c6..800881c077 100644 --- a/qpid/cpp/src/qpid/log/Logger.cpp +++ b/qpid/cpp/src/qpid/log/Logger.cpp @@ -93,7 +93,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) { |