Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes for macos / clang builds #135

Merged
merged 2 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.build/

# Locally installed dependencies
.deps/
deps/

# Compiled Object files
*.slo
Expand Down
2 changes: 1 addition & 1 deletion include/datadog/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace datadog {
namespace version {

const std::string tracer_version = "v1.1.4";
const std::string tracer_version = "v1.1.5";
const std::string cpp_version = std::to_string(__cplusplus);

} // namespace version
Expand Down
9 changes: 6 additions & 3 deletions src/limiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ LimitResult Limiter::allow(long tokens_requested) {
num_requested_++;
// refill "tokens"
if (now >= next_refresh_) {
auto intervals = (now - next_refresh_) / refresh_interval_ + 1;
auto intervals = (now - next_refresh_).count() / refresh_interval_.count() + 1;
if (intervals > 0) {
next_refresh_ += (refresh_interval_ * intervals);
num_tokens_ = std::min(max_tokens_, num_tokens_ + intervals * tokens_per_refresh_);
next_refresh_ += refresh_interval_ * intervals;
num_tokens_ += intervals * tokens_per_refresh_;
if (num_tokens_ > max_tokens_) {
num_tokens_ = max_tokens_;
}
}
}
// determine if allowed or not
Expand Down
4 changes: 2 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ add_library(catch STATIC test_main.cpp)
macro(_datadog_test TEST_NAME)
add_executable(${TEST_NAME} ${ARGN})
add_sanitizers(${TEST_NAME})
target_link_libraries(${TEST_NAME} ${DATADOG_LINK_LIBRARIES}
dd_opentracing
target_link_libraries(${TEST_NAME} dd_opentracing
${DATADOG_LINK_LIBRARIES}
catch)
add_test(${TEST_NAME} ${TEST_NAME})
endmacro()
Expand Down