This is an automated email from the ASF dual-hosted git repository.
zykkk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new ba0eb23db01 [fix][compile] Resolve time_point type mismatch on MacOS
and Linux (#38049)
ba0eb23db01 is described below
commit ba0eb23db012dfebf340c161db6f20b57d0d801f
Author: zy-kkk <[email protected]>
AuthorDate: Thu Jul 18 14:39:50 2024 +0800
[fix][compile] Resolve time_point type mismatch on MacOS and Linux (#38049)
revert #38036
We cannot change the time_point type directly, but use macros to
distinguish different compilation platforms, refer to #34054
---
common/cpp/s3_rate_limiter.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/common/cpp/s3_rate_limiter.cpp b/common/cpp/s3_rate_limiter.cpp
index 108dacd106f..3bd311bc955 100644
--- a/common/cpp/s3_rate_limiter.cpp
+++ b/common/cpp/s3_rate_limiter.cpp
@@ -22,6 +22,12 @@
#include <chrono>
#include <mutex>
#include <thread>
+#if defined(__APPLE__)
+#include <ctime>
+#define CURRENT_TIME std::chrono::system_clock::now()
+#else
+#define CURRENT_TIME std::chrono::high_resolution_clock::now()
+#endif
namespace doris {
// Just 10^6.
@@ -85,8 +91,7 @@ std::pair<size_t, double> S3RateLimiter::_update_remain_token(
int64_t S3RateLimiter::add(size_t amount) {
// Values obtained under lock to be checked after release
- auto [count_value, tokens_value] =
- _update_remain_token(std::chrono::system_clock::now(), amount);
+ auto [count_value, tokens_value] = _update_remain_token(CURRENT_TIME,
amount);
if (_limit && count_value > _limit) {
// CK would throw exception
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]