diff options
author | Alan Conway <aconway@apache.org> | 2012-02-13 16:18:39 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2012-02-13 16:18:39 +0000 |
commit | e93c50e3cc997d7d83c09711928bf030d62a40e6 (patch) | |
tree | 437b57c4cf7397e85a4ecf344876f80bb8f23a40 | |
parent | b3cff4e5d1bcf0928b364d43785d8e5fadb062ed (diff) | |
download | qpid-python-e93c50e3cc997d7d83c09711928bf030d62a40e6.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-2@1243583 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 1600822142..92578b8357 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 9661f0c5e8..df77e05dc5 100644 --- a/qpid/cpp/src/qpid/sys/posix/Time.cpp +++ b/qpid/cpp/src/qpid/sys/posix/Time.cpp @@ -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) { |