Skip to content

Commit

Permalink
feat core: do not use tuple header in LRU cache components
Browse files Browse the repository at this point in the history
Tests: протестировано CI
8d688c7f2bd7feb609f0dec9990d2dff683433c7
  • Loading branch information
apolukhin committed Jun 21, 2024
1 parent 49ef7dc commit ea75a90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions core/include/userver/utils/impl/cached_time.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once

#include <chrono>
#include <tuple>

USERVER_NAMESPACE_BEGIN

Expand All @@ -15,9 +14,14 @@ using SteadyTimePoint = std::chrono::steady_clock::time_point;
// be costly, so as an optimization we cache now() globally.
void UpdateGlobalTime();

struct SystemAndSteadyTimePoints {
SystemTimePoint system;
SteadyTimePoint steady;
};

// Note: the two time points are not synchronized. They may also come from
// different 'UpdateGlobalTime' calls.
std::tuple<SystemTimePoint, SteadyTimePoint> GetGlobalTime();
SystemAndSteadyTimePoints GetGlobalTime();

} // namespace utils::impl

Expand Down
2 changes: 1 addition & 1 deletion core/src/utils/impl/cached_time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void UpdateGlobalTime() {
std::memory_order_relaxed);
}

std::tuple<SystemTimePoint, SteadyTimePoint> GetGlobalTime() {
SystemAndSteadyTimePoints GetGlobalTime() {
return {system_clock_now.load(std::memory_order_relaxed),
steady_clock_now.load(std::memory_order_relaxed)};
}
Expand Down

0 comments on commit ea75a90

Please sign in to comment.