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 0132ef8d2d3 [fix][compile] Resolve time_point type mismatch on MacOS 
and Linux (#34054)
0132ef8d2d3 is described below

commit 0132ef8d2d301a2e62be32bffa42919045a204f9
Author: zy-kkk <[email protected]>
AuthorDate: Wed Apr 24 15:19:21 2024 +0800

    [fix][compile] Resolve time_point type mismatch on MacOS and Linux (#34054)
---
 be/src/util/s3_rate_limiter.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/be/src/util/s3_rate_limiter.cpp b/be/src/util/s3_rate_limiter.cpp
index e39c8a54c46..44099ab1438 100644
--- a/be/src/util/s3_rate_limiter.cpp
+++ b/be/src/util/s3_rate_limiter.cpp
@@ -24,6 +24,12 @@
 #include "util/s3_util.h"
 #include "util/spinlock.h"
 #include "util/time.h"
+#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.
@@ -51,8 +57,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::high_resolution_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]

Reply via email to