From 983c494968da6090f7ed01b0b1ac9c4b390bf8a1 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Wed, 12 Mar 2025 15:19:02 +0900 Subject: [PATCH] Use constexpr for constants --- src/UDPC_Defines.hpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/UDPC_Defines.hpp b/src/UDPC_Defines.hpp index 7369271..8da68fd 100644 --- a/src/UDPC_Defines.hpp +++ b/src/UDPC_Defines.hpp @@ -58,17 +58,17 @@ namespace UDPC { -static const auto ONE_SECOND = std::chrono::seconds(1); -static const auto TEN_SECONDS = std::chrono::seconds(10); -static const auto THIRTY_SECONDS = std::chrono::seconds(30); - -static const auto INIT_PKT_INTERVAL_DT = std::chrono::seconds(5); -static const auto HEARTBEAT_PKT_INTERVAL_DT = std::chrono::milliseconds(150); -static const auto PACKET_TIMEOUT_TIME = ONE_SECOND; -static const auto GOOD_RTT_LIMIT = std::chrono::milliseconds(250); -static const auto CONNECTION_TIMEOUT = TEN_SECONDS; -static const auto GOOD_MODE_SEND_RATE = std::chrono::microseconds(33333); -static const auto BAD_MODE_SEND_RATE = std::chrono::milliseconds(100); +constexpr auto ONE_SECOND = std::chrono::seconds(1); +constexpr auto TEN_SECONDS = std::chrono::seconds(10); +constexpr auto THIRTY_SECONDS = std::chrono::seconds(30); + +constexpr auto INIT_PKT_INTERVAL_DT = std::chrono::seconds(5); +constexpr auto HEARTBEAT_PKT_INTERVAL_DT = std::chrono::milliseconds(150); +constexpr auto PACKET_TIMEOUT_TIME = ONE_SECOND; +constexpr auto GOOD_RTT_LIMIT = std::chrono::milliseconds(250); +constexpr auto CONNECTION_TIMEOUT = TEN_SECONDS; +constexpr auto GOOD_MODE_SEND_RATE = std::chrono::microseconds(33333); +constexpr auto BAD_MODE_SEND_RATE = std::chrono::milliseconds(100); // forward declaration struct Context; -- 2.49.0