This is an automated email from the ASF dual-hosted git repository.
rmiddleton pushed a commit to branch LOGCXX-514
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/LOGCXX-514 by this push:
new 00b87e64 try to switch around timepoint
00b87e64 is described below
commit 00b87e6490c27e0017a196aa65d5b16bd719dcdd
Author: Robert Middleton <[email protected]>
AuthorDate: Thu Nov 24 09:58:04 2022 -0500
try to switch around timepoint
---
src/main/cpp/loggingevent.cpp | 2 +-
src/main/include/log4cxx/log4cxx.h.in | 2 +-
src/test/cpp/fmttest.cpp | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/main/cpp/loggingevent.cpp b/src/main/cpp/loggingevent.cpp
index f58924da..4e20dad5 100644
--- a/src/main/cpp/loggingevent.cpp
+++ b/src/main/cpp/loggingevent.cpp
@@ -73,7 +73,7 @@ struct LoggingEvent::LoggingEventPrivate
locationInfo(locationInfo1),
threadName(getCurrentThreadName()),
threadUserName(getCurrentThreadUserName()),
- chronoTimeStamp(std::chrono::milliseconds(timeStamp))
+ chronoTimeStamp(std::chrono::microseconds(timeStamp))
{
}
diff --git a/src/main/include/log4cxx/log4cxx.h.in
b/src/main/include/log4cxx/log4cxx.h.in
index 251be8e4..db930599 100644
--- a/src/main/include/log4cxx/log4cxx.h.in
+++ b/src/main/include/log4cxx/log4cxx.h.in
@@ -62,7 +62,7 @@ typedef unsigned int log4cxx_uint32_t;
#include <memory>
#include <chrono>
-typedef std::chrono::time_point<std::chrono::system_clock> log4cxx_timepoint_t;
+typedef std::chrono::time_point<std::chrono::high_resolution_clock>
log4cxx_timepoint_t;
#define LOG4CXX_PTR_DEF(T) typedef std::shared_ptr<T> T##Ptr;\
typedef std::weak_ptr<T> T##WeakPtr
diff --git a/src/test/cpp/fmttest.cpp b/src/test/cpp/fmttest.cpp
index 6752e1e3..4ee49eb8 100644
--- a/src/test/cpp/fmttest.cpp
+++ b/src/test/cpp/fmttest.cpp
@@ -134,10 +134,10 @@ public:
std::stringstream ss("2013-04-11 08:35:34");
ss >> std::get_time(&tm, "%Y-%m-%d %H:%M:%S");
auto tp =
std::chrono::system_clock::from_time_t(std::mktime(&tm));
- uint64_t millis =
std::chrono::duration_cast<std::chrono::milliseconds>(tp.time_since_epoch()).count();
+ uint64_t micros =
std::chrono::duration_cast<std::chrono::microseconds>(tp.time_since_epoch()).count();
- log4cxx::helpers::Date::setGetCurrentTimeFunction([millis](){
- return millis;
+ log4cxx::helpers::Date::setGetCurrentTimeFunction([micros](){
+ return micros;
});
log4cxx::spi::LoggingEventPtr logEvt =
std::make_shared<log4cxx::spi::LoggingEvent>( "foo",