diff options
| author | Kim van der Riet <kpvdr@apache.org> | 2011-05-02 13:20:36 +0000 |
|---|---|---|
| committer | Kim van der Riet <kpvdr@apache.org> | 2011-05-02 13:20:36 +0000 |
| commit | dbc838fff0b0f157cc13af058f44779e84be65b6 (patch) | |
| tree | 4908c7d8d094128c832144690a30618f58ba0a2e /cpp/src/qpid/sys | |
| parent | 9a632f4313cd04646c9b995142d508aeabc21d88 (diff) | |
| download | qpid-python-dbc838fff0b0f157cc13af058f44779e84be65b6.tar.gz | |
QPID-3236 - Add high-resolution timestamps to log files for debug situations. Windows impl has a stub only.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1098554 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys')
| -rw-r--r-- | cpp/src/qpid/sys/posix/Time.cpp | 7 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/windows/Time.cpp | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/cpp/src/qpid/sys/posix/Time.cpp b/cpp/src/qpid/sys/posix/Time.cpp index b3858279b4..9661f0c5e8 100644 --- a/cpp/src/qpid/sys/posix/Time.cpp +++ b/cpp/src/qpid/sys/posix/Time.cpp @@ -27,6 +27,7 @@ #include <stdio.h> #include <sys/time.h> #include <unistd.h> +#include <iomanip> namespace { int64_t max_abstime() { return std::numeric_limits<int64_t>::max(); } @@ -103,6 +104,12 @@ void outputFormattedNow(std::ostream& o) { 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 "; +} + void sleep(int secs) { ::sleep(secs); } diff --git a/cpp/src/qpid/sys/windows/Time.cpp b/cpp/src/qpid/sys/windows/Time.cpp index 16d09fcdc0..56eade651a 100644 --- a/cpp/src/qpid/sys/windows/Time.cpp +++ b/cpp/src/qpid/sys/windows/Time.cpp @@ -97,4 +97,13 @@ void outputFormattedNow(std::ostream& o) { &timeinfo); o << time_string << " "; } + +void outputHiresNow(std::ostream& o) { +// TODO: This is a stub - replace with windows code that will do the equivalent +// of the Linux code commented out below. (kpvdr) +// ::timespec time; +// ::clock_gettime(CLOCK_REALTIME, &time); +// o << time.tv_sec << "." << std::setw(9) << std::setfill('0') << time.tv_nsec << "s "; + o << "XXXXXXXXX.XXXXXXXXXs "; +} }} |
