]> git.seodisparate.com - UDPConnection/commitdiff
Use constexpr for constants
authorStephen Seo <seo.disparate@gmail.com>
Wed, 12 Mar 2025 06:19:02 +0000 (15:19 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Wed, 12 Mar 2025 06:19:02 +0000 (15:19 +0900)
src/UDPC_Defines.hpp

index 7369271115ce3cef7267dc5abcbc6176355d0573..8da68fdca306c7b301a3304d7def6f51bb5b0155 100644 (file)
 
 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;