From: Stephen Seo Date: Wed, 12 Mar 2025 06:19:02 +0000 (+0900) Subject: Use constexpr for constants X-Git-Tag: 1.3^2~6 X-Git-Url: https://git.seodisparate.com/js/bootstrap.bundle.min.js?a=commitdiff_plain;h=983c494968da6090f7ed01b0b1ac9c4b390bf8a1;p=UDPConnection Use constexpr for constants --- 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;