From 2606457a2b89bb312853903092fd077821c5efe1 Mon Sep 17 00:00:00 2001 From: Kevin Schoedel <67607049+kpschoedel@users.noreply.github.com> Date: Tue, 2 Nov 2021 14:43:33 -0400 Subject: [PATCH] Rename System::Clock::Zero to System::Clock::kZero (#11327) #### Problem `System::Clock::Zero` is a constants that doesn't follow the usual convention of being named with a leading `k`. Requested in PR #11238 review. #### Change overview Rename `System::Clock::Zero` to `System::Clock::kZero`. #### Testing CI; no changes to functionality. --- examples/lock-app/esp32/main/AppTask.cpp | 2 +- examples/shell/shell_common/cmd_ping.cpp | 2 +- examples/shell/shell_common/cmd_send.cpp | 2 +- src/app/EventManagement.cpp | 6 +++--- src/app/tests/integration/MockEvents.cpp | 2 +- src/app/tests/integration/chip_im_initiator.cpp | 4 ++-- .../GenericConnectivityManagerImpl_NoWiFi.h | 4 ++-- .../internal/GenericConnectivityManagerImpl_WiFi.h | 4 ++-- .../minimal_mdns/responders/QueryResponder.cpp | 2 +- .../dnssd/minimal_mdns/responders/QueryResponder.h | 11 ++++++----- src/messaging/ExchangeContext.cpp | 2 +- src/messaging/ReliableMessageMgr.cpp | 4 ++-- src/messaging/tests/echo/echo_requester.cpp | 4 ++-- src/platform/Ameba/ConnectivityManagerImpl.cpp | 12 ++++++------ .../ESP32/ConnectivityManagerImpl_WiFi.cpp | 14 +++++++------- src/platform/ESP32/PlatformManagerImpl.h | 2 +- src/platform/Linux/ConnectivityManagerImpl.cpp | 4 ++-- src/platform/Linux/PlatformManagerImpl.h | 2 +- src/platform/P6/ConnectivityManagerImpl.cpp | 14 +++++++------- src/platform/Tizen/ConnectivityManagerImpl.cpp | 2 +- src/platform/Tizen/ConnectivityManagerImpl.h | 2 +- src/platform/android/ConnectivityManagerImpl.cpp | 2 +- src/platform/tests/TestPlatformMgr.cpp | 4 ++-- src/protocols/bdx/BdxTransferSession.cpp | 4 ++-- src/protocols/bdx/BdxTransferSession.h | 4 ++-- src/protocols/bdx/tests/TestBdxTransferSession.cpp | 2 +- src/system/SystemClock.h | 2 +- src/system/SystemLayerImplLibevent.cpp | 2 +- src/system/SystemLayerImplLwIP.cpp | 6 +++--- src/system/SystemLayerImplSelect.cpp | 6 +++--- src/system/tests/TestSystemClock.cpp | 6 +++--- src/system/tests/TestSystemTimer.cpp | 4 ++-- 32 files changed, 72 insertions(+), 71 deletions(-) diff --git a/examples/lock-app/esp32/main/AppTask.cpp b/examples/lock-app/esp32/main/AppTask.cpp index e37044c0fc4dfd..df3cd9cf3437c8 100644 --- a/examples/lock-app/esp32/main/AppTask.cpp +++ b/examples/lock-app/esp32/main/AppTask.cpp @@ -114,7 +114,7 @@ CHIP_ERROR AppTask::Init() void AppTask::AppTaskMain(void * pvParameter) { AppEvent event; - Clock::Timestamp lastChangeTime = Clock::Zero; + Clock::Timestamp lastChangeTime = Clock::kZero; CHIP_ERROR err = sAppTask.Init(); if (err != CHIP_NO_ERROR) diff --git a/examples/shell/shell_common/cmd_ping.cpp b/examples/shell/shell_common/cmd_ping.cpp index a74baebf96c450..232c3ac7e3f1c0 100644 --- a/examples/shell/shell_common/cmd_ping.cpp +++ b/examples/shell/shell_common/cmd_ping.cpp @@ -50,7 +50,7 @@ class PingArguments { mMaxEchoCount = 3; mEchoInterval = 1000; - mLastEchoTime = System::Clock::Zero; + mLastEchoTime = System::Clock::kZero; mEchoCount = 0; mEchoRespCount = 0; mPayloadSize = 32; diff --git a/examples/shell/shell_common/cmd_send.cpp b/examples/shell/shell_common/cmd_send.cpp index c85563ad791c63..fee138b2b3a43c 100644 --- a/examples/shell/shell_common/cmd_send.cpp +++ b/examples/shell/shell_common/cmd_send.cpp @@ -47,7 +47,7 @@ class SendArguments { mProtocolId = 0x0002; mMessageType = 1; - mLastSendTime = System::Clock::Zero; + mLastSendTime = System::Clock::kZero; mPayloadSize = 32; #if INET_CONFIG_ENABLE_TCP_ENDPOINT mUsingTCP = false; diff --git a/src/app/EventManagement.cpp b/src/app/EventManagement.cpp index c328c938996bfd..5fa2eaeb1db386 100644 --- a/src/app/EventManagement.cpp +++ b/src/app/EventManagement.cpp @@ -87,7 +87,7 @@ struct EventEnvelopeContext uint16_t mFieldsToRead = 0; /* PriorityLevel and DeltaSystemTimestamp are there if that is not first event when putting events in report*/ - Timestamp mDeltaSystemTime = Timestamp::System(System::Clock::Zero); + Timestamp mDeltaSystemTime = Timestamp::System(System::Clock::kZero); Timestamp mDeltaUtc = Timestamp::UTC(0); PriorityLevel mPriority = PriorityLevel::First; NodeId mNodeId = 0; @@ -855,8 +855,8 @@ void CircularEventBuffer::Init(uint8_t * apBuffer, uint32_t aBufferLength, Circu mPriority = aPriorityLevel; mFirstEventNumber = 1; mLastEventNumber = 0; - mFirstEventSystemTimestamp = Timestamp::System(System::Clock::Zero); - mLastEventSystemTimestamp = Timestamp::System(System::Clock::Zero); + mFirstEventSystemTimestamp = Timestamp::System(System::Clock::kZero); + mLastEventSystemTimestamp = Timestamp::System(System::Clock::kZero); mpEventNumberCounter = nullptr; } diff --git a/src/app/tests/integration/MockEvents.cpp b/src/app/tests/integration/MockEvents.cpp index d89b0a3058b32f..1792050d68922d 100644 --- a/src/app/tests/integration/MockEvents.cpp +++ b/src/app/tests/integration/MockEvents.cpp @@ -188,7 +188,7 @@ void MockEventGeneratorImpl::SetEventGeneratorStop() // This helps quit the standalone app in an orderly way without // spurious leaked timers. if (mTimeBetweenEvents != 0) - mpExchangeMgr->GetSessionManager()->SystemLayer()->StartTimer(chip::System::Clock::Zero, HandleNextEvent, this); + mpExchangeMgr->GetSessionManager()->SystemLayer()->StartTimer(chip::System::Clock::kZero, HandleNextEvent, this); } bool MockEventGeneratorImpl::IsEventGeneratorStopped() diff --git a/src/app/tests/integration/chip_im_initiator.cpp b/src/app/tests/integration/chip_im_initiator.cpp index 172720afceaddf..2aba011b7c2dbf 100644 --- a/src/app/tests/integration/chip_im_initiator.cpp +++ b/src/app/tests/integration/chip_im_initiator.cpp @@ -63,7 +63,7 @@ chip::TransportMgr gTransportManager; chip::Inet::IPAddress gDestAddr; // The last time a CHIP Command was attempted to be sent. -chip::System::Clock::Timestamp gLastMessageTime = chip::System::Clock::Zero; +chip::System::Clock::Timestamp gLastMessageTime = chip::System::Clock::kZero; // Count of the number of CommandRequests sent. uint64_t gCommandCount = 0; @@ -703,7 +703,7 @@ int main(int argc, char * argv[]) err = EstablishSecureSession(); SuccessOrExit(err); - err = chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Zero, CommandRequestTimerHandler, NULL); + err = chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::kZero, CommandRequestTimerHandler, NULL); SuccessOrExit(err); chip::DeviceLayer::PlatformMgr().RunEventLoop(); diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_NoWiFi.h b/src/include/platform/internal/GenericConnectivityManagerImpl_NoWiFi.h index f29355b2691d18..9e583ed6ef552d 100644 --- a/src/include/platform/internal/GenericConnectivityManagerImpl_NoWiFi.h +++ b/src/include/platform/internal/GenericConnectivityManagerImpl_NoWiFi.h @@ -123,7 +123,7 @@ inline bool GenericConnectivityManagerImpl_NoWiFi::_IsWiFiStationConn template inline System::Clock::Timeout GenericConnectivityManagerImpl_NoWiFi::_GetWiFiStationReconnectInterval(void) { - return System::Clock::Zero; + return System::Clock::kZero; } template @@ -181,7 +181,7 @@ inline void GenericConnectivityManagerImpl_NoWiFi::_MaintainOnDemandW template inline System::Clock::Timeout GenericConnectivityManagerImpl_NoWiFi::_GetWiFiAPIdleTimeout(void) { - return System::Clock::Zero; + return System::Clock::kZero; } template diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_WiFi.h b/src/include/platform/internal/GenericConnectivityManagerImpl_WiFi.h index 630ba1bbc66898..a79e79628ae0c4 100644 --- a/src/include/platform/internal/GenericConnectivityManagerImpl_WiFi.h +++ b/src/include/platform/internal/GenericConnectivityManagerImpl_WiFi.h @@ -109,7 +109,7 @@ class GenericConnectivityManagerImpl_WiFi template inline System::Clock::Timeout GenericConnectivityManagerImpl_WiFi::_GetWiFiStationReconnectInterval() { - return System::Clock::Zero; + return System::Clock::kZero; } template @@ -167,7 +167,7 @@ inline void GenericConnectivityManagerImpl_WiFi::_MaintainOnDemandWiF template inline System::Clock::Timeout GenericConnectivityManagerImpl_WiFi::_GetWiFiAPIdleTimeout() { - return System::Clock::Zero; + return System::Clock::kZero; } template diff --git a/src/lib/dnssd/minimal_mdns/responders/QueryResponder.cpp b/src/lib/dnssd/minimal_mdns/responders/QueryResponder.cpp index b2cf27c91726cb..904e664528c896 100644 --- a/src/lib/dnssd/minimal_mdns/responders/QueryResponder.cpp +++ b/src/lib/dnssd/minimal_mdns/responders/QueryResponder.cpp @@ -160,7 +160,7 @@ void QueryResponderBase::ClearBroadcastThrottle() { for (size_t i = 0; i < mResponderInfoSize; i++) { - mResponderInfos[i].lastMulticastTime = chip::System::Clock::Zero; + mResponderInfos[i].lastMulticastTime = chip::System::Clock::kZero; } } diff --git a/src/lib/dnssd/minimal_mdns/responders/QueryResponder.h b/src/lib/dnssd/minimal_mdns/responders/QueryResponder.h index 27b83cae84ef1d..356c238f11a86a 100644 --- a/src/lib/dnssd/minimal_mdns/responders/QueryResponder.h +++ b/src/lib/dnssd/minimal_mdns/responders/QueryResponder.h @@ -29,9 +29,9 @@ namespace Minimal { /// Represents available data (replies) for mDNS queries. struct QueryResponderRecord { - Responder * responder = nullptr; // what response/data is available - bool reportService = false; // report as a service when listing dnssd services - chip::System::Clock::Timestamp lastMulticastTime = chip::System::Clock::Zero; // last time this record was multicast + Responder * responder = nullptr; // what response/data is available + bool reportService = false; // report as a service when listing dnssd services + chip::System::Clock::Timestamp lastMulticastTime = chip::System::Clock::kZero; // last time this record was multicast }; namespace Internal { @@ -140,7 +140,8 @@ class QueryResponderRecordFilter return false; } - if ((mIncludeOnlyMulticastBefore > chip::System::Clock::Zero) && (record->lastMulticastTime >= mIncludeOnlyMulticastBefore)) + if ((mIncludeOnlyMulticastBefore > chip::System::Clock::kZero) && + (record->lastMulticastTime >= mIncludeOnlyMulticastBefore)) { return false; } @@ -156,7 +157,7 @@ class QueryResponderRecordFilter private: bool mIncludeAdditionalRepliesOnly = false; ReplyFilter * mReplyFilter = nullptr; - chip::System::Clock::Timestamp mIncludeOnlyMulticastBefore = chip::System::Clock::Zero; + chip::System::Clock::Timestamp mIncludeOnlyMulticastBefore = chip::System::Clock::kZero; }; /// Iterates over an array of QueryResponderRecord items, providing only 'valid' ones, where diff --git a/src/messaging/ExchangeContext.cpp b/src/messaging/ExchangeContext.cpp index 9661f7020d4cdd..df471d658628f3 100644 --- a/src/messaging/ExchangeContext.cpp +++ b/src/messaging/ExchangeContext.cpp @@ -124,7 +124,7 @@ CHIP_ERROR ExchangeContext::SendMessage(Protocols::Id protocolId, uint8_t msgTyp SetResponseExpected(true); // Arm the response timer if a timeout has been specified. - if (mResponseTimeout > System::Clock::Zero) + if (mResponseTimeout > System::Clock::kZero) { CHIP_ERROR err = StartResponseTimer(); if (err != CHIP_NO_ERROR) diff --git a/src/messaging/ReliableMessageMgr.cpp b/src/messaging/ReliableMessageMgr.cpp index 6188cf025dafe2..05eea6d942e691 100644 --- a/src/messaging/ReliableMessageMgr.cpp +++ b/src/messaging/ReliableMessageMgr.cpp @@ -59,7 +59,7 @@ void ReliableMessageMgr::Init(chip::System::Layer * systemLayer, SessionManager { mSystemLayer = systemLayer; mTimeStampBase = System::SystemClock().GetMonotonicTimestamp(); - mCurrentTimerExpiry = System::Clock::Zero; + mCurrentTimerExpiry = System::Clock::kZero; } void ReliableMessageMgr::Shutdown() @@ -448,7 +448,7 @@ void ReliableMessageMgr::StartTimer() // If the tick boundary has expired in the past (delayed processing of event due to other system activity), // expire the timer immediately System::Clock::Timestamp now = System::SystemClock().GetMonotonicTimestamp(); - System::Clock::Timeout timerArmValue = (timerExpiry > now) ? timerExpiry - now : System::Clock::Zero; + System::Clock::Timeout timerArmValue = (timerExpiry > now) ? timerExpiry - now : System::Clock::kZero; #if defined(RMP_TICKLESS_DEBUG) ChipLogDetail(ExchangeManager, "ReliableMessageMgr::StartTimer set timer for %" PRIu32 " ms", diff --git a/src/messaging/tests/echo/echo_requester.cpp b/src/messaging/tests/echo/echo_requester.cpp index ae767867b14b60..7e4b2bed43fa43 100644 --- a/src/messaging/tests/echo/echo_requester.cpp +++ b/src/messaging/tests/echo/echo_requester.cpp @@ -62,7 +62,7 @@ chip::TransportMgr= mLastStationConnectFailTime + mWiFiStationReconnectInterval) { ChipLogProgress(DeviceLayer, "Attempting to connect WiFi station interface"); diff --git a/src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp b/src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp index eb519645c55507..aa484a1b33ea80 100644 --- a/src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp +++ b/src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp @@ -142,7 +142,7 @@ void ConnectivityManagerImpl::_StopOnDemandWiFiAP(void) { if (mWiFiAPMode == kWiFiAPMode_OnDemand || mWiFiAPMode == kWiFiAPMode_OnDemand_NoStationProvision) { - mLastAPDemandTime = System::Clock::Zero; + mLastAPDemandTime = System::Clock::kZero; DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, NULL); } } @@ -375,8 +375,8 @@ CHIP_ERROR ConnectivityManagerImpl::_GetAndLogWifiStatsCounters(void) CHIP_ERROR ConnectivityManagerImpl::InitWiFi() { - mLastStationConnectFailTime = System::Clock::Zero; - mLastAPDemandTime = System::Clock::Zero; + mLastStationConnectFailTime = System::Clock::kZero; + mLastAPDemandTime = System::Clock::kZero; mWiFiStationMode = kWiFiStationMode_Disabled; mWiFiStationState = kWiFiStationState_NotConnected; mWiFiAPMode = kWiFiAPMode_Disabled; @@ -551,7 +551,7 @@ void ConnectivityManagerImpl::DriveStationState() { ChangeWiFiStationState(kWiFiStationState_Connected); ChipLogProgress(DeviceLayer, "WiFi station interface connected"); - mLastStationConnectFailTime = System::Clock::Zero; + mLastStationConnectFailTime = System::Clock::kZero; OnStationConnected(); } @@ -588,7 +588,7 @@ void ConnectivityManagerImpl::DriveStationState() if (prevState != kWiFiStationState_Connecting_Failed) { ChipLogProgress(DeviceLayer, "WiFi station interface disconnected"); - mLastStationConnectFailTime = System::Clock::Zero; + mLastStationConnectFailTime = System::Clock::kZero; OnStationDisconnected(); } else @@ -604,7 +604,7 @@ void ConnectivityManagerImpl::DriveStationState() { // Initiate a connection to the AP if we haven't done so before, or if enough // time has passed since the last attempt. - if (mLastStationConnectFailTime == System::Clock::Zero || + if (mLastStationConnectFailTime == System::Clock::kZero || now >= mLastStationConnectFailTime + mWiFiStationReconnectInterval) { ChipLogProgress(DeviceLayer, "Attempting to connect WiFi station interface"); @@ -740,7 +740,7 @@ void ConnectivityManagerImpl::DriveAPState() { System::Clock::Timestamp now = System::SystemClock().GetMonotonicTimestamp(); - if (mLastAPDemandTime != System::Clock::Zero && now < (mLastAPDemandTime + mWiFiAPIdleTimeout)) + if (mLastAPDemandTime != System::Clock::kZero && now < (mLastAPDemandTime + mWiFiAPIdleTimeout)) { targetState = kWiFiAPState_Active; diff --git a/src/platform/ESP32/PlatformManagerImpl.h b/src/platform/ESP32/PlatformManagerImpl.h index 8718c456b5550c..e29433190e37e4 100644 --- a/src/platform/ESP32/PlatformManagerImpl.h +++ b/src/platform/ESP32/PlatformManagerImpl.h @@ -70,7 +70,7 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener friend PlatformManager & PlatformMgr(void); friend PlatformManagerImpl & PlatformMgrImpl(void); - chip::System::Clock::Timestamp mStartTime = System::Clock::Zero; + chip::System::Clock::Timestamp mStartTime = System::Clock::kZero; static PlatformManagerImpl sInstance; }; diff --git a/src/platform/Linux/ConnectivityManagerImpl.cpp b/src/platform/Linux/ConnectivityManagerImpl.cpp index 3092695ccf1da9..2a0da89c490a32 100644 --- a/src/platform/Linux/ConnectivityManagerImpl.cpp +++ b/src/platform/Linux/ConnectivityManagerImpl.cpp @@ -452,7 +452,7 @@ void ConnectivityManagerImpl::_StopOnDemandWiFiAP() if (mWiFiAPMode == kWiFiAPMode_OnDemand || mWiFiAPMode == kWiFiAPMode_OnDemand_NoStationProvision) { ChipLogProgress(DeviceLayer, "wpa_supplicant: Demand stop WiFi AP"); - mLastAPDemandTime = System::Clock::Zero; + mLastAPDemandTime = System::Clock::kZero; DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, NULL); } else @@ -769,7 +769,7 @@ void ConnectivityManagerImpl::DriveAPState() { System::Clock::Timestamp now = System::SystemClock().GetMonotonicTimestamp(); - if (mLastAPDemandTime != System::Clock::Zero && now < (mLastAPDemandTime + mWiFiAPIdleTimeout)) + if (mLastAPDemandTime != System::Clock::kZero && now < (mLastAPDemandTime + mWiFiAPIdleTimeout)) { targetState = kWiFiAPState_Active; diff --git a/src/platform/Linux/PlatformManagerImpl.h b/src/platform/Linux/PlatformManagerImpl.h index 7cfd51e4c79621..7c9dc1df6ea525 100644 --- a/src/platform/Linux/PlatformManagerImpl.h +++ b/src/platform/Linux/PlatformManagerImpl.h @@ -76,7 +76,7 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener friend PlatformManagerImpl & PlatformMgrImpl(); friend class Internal::BLEManagerImpl; - System::Clock::Timestamp mStartTime = System::Clock::Zero; + System::Clock::Timestamp mStartTime = System::Clock::kZero; static PlatformManagerImpl sInstance; diff --git a/src/platform/P6/ConnectivityManagerImpl.cpp b/src/platform/P6/ConnectivityManagerImpl.cpp index 2106db96391cc3..41c4e47fd8df0f 100644 --- a/src/platform/P6/ConnectivityManagerImpl.cpp +++ b/src/platform/P6/ConnectivityManagerImpl.cpp @@ -131,7 +131,7 @@ void ConnectivityManagerImpl::_StopOnDemandWiFiAP(void) { if (mWiFiAPMode == kWiFiAPMode_OnDemand || mWiFiAPMode == kWiFiAPMode_OnDemand_NoStationProvision) { - mLastAPDemandTime = System::Clock::Zero; + mLastAPDemandTime = System::Clock::kZero; DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, NULL); } } @@ -182,8 +182,8 @@ CHIP_ERROR ConnectivityManagerImpl::_Init() { CHIP_ERROR err = CHIP_NO_ERROR; cy_rslt_t result = CY_RSLT_SUCCESS; - mLastStationConnectFailTime = System::Clock::Zero; - mLastAPDemandTime = System::Clock::Zero; + mLastStationConnectFailTime = System::Clock::kZero; + mLastAPDemandTime = System::Clock::kZero; mWiFiStationMode = kWiFiStationMode_Disabled; mWiFiStationState = kWiFiStationState_NotConnected; mWiFiAPMode = kWiFiAPMode_Disabled; @@ -404,7 +404,7 @@ void ConnectivityManagerImpl::DriveAPState() { System::Clock::Timestamp now = System::SystemClock().GetMonotonicTimestamp(); - if (mLastAPDemandTime != System::Clock::Zero && now < (mLastAPDemandTime + mWiFiAPIdleTimeout)) + if (mLastAPDemandTime != System::Clock::kZero && now < (mLastAPDemandTime + mWiFiAPIdleTimeout)) { targetState = kWiFiAPState_Active; @@ -502,7 +502,7 @@ void ConnectivityManagerImpl::DriveStationState() { ChangeWiFiStationState(kWiFiStationState_Connected); ChipLogProgress(DeviceLayer, "WiFi station interface connected"); - mLastStationConnectFailTime = System::Clock::Zero; + mLastStationConnectFailTime = System::Clock::kZero; } // If the WiFi station interface is no longer enabled, or no longer provisioned, @@ -537,7 +537,7 @@ void ConnectivityManagerImpl::DriveStationState() if (prevState != kWiFiStationState_Connecting_Failed) { ChipLogProgress(DeviceLayer, "WiFi station interface disconnected"); - mLastStationConnectFailTime = System::Clock::Zero; + mLastStationConnectFailTime = System::Clock::kZero; } else { @@ -551,7 +551,7 @@ void ConnectivityManagerImpl::DriveStationState() { // Initiate a connection to the AP if we haven't done so before, or if enough // time has passed since the last attempt. - if (mLastStationConnectFailTime == System::Clock::Zero || + if (mLastStationConnectFailTime == System::Clock::kZero || now >= mLastStationConnectFailTime + mWiFiStationReconnectInterval) { ChangeWiFiStationState(kWiFiStationState_Connecting); diff --git a/src/platform/Tizen/ConnectivityManagerImpl.cpp b/src/platform/Tizen/ConnectivityManagerImpl.cpp index dc796f7403786a..27ae77affd2352 100644 --- a/src/platform/Tizen/ConnectivityManagerImpl.cpp +++ b/src/platform/Tizen/ConnectivityManagerImpl.cpp @@ -55,7 +55,7 @@ CHIP_ERROR ConnectivityManagerImpl::_Init(void) mWiFiStationMode = kWiFiStationMode_Disabled; mWiFiAPMode = kWiFiAPMode_Disabled; mWiFiAPState = kWiFiAPState_NotActive; - mLastAPDemandTime = System::Clock::Zero; + mLastAPDemandTime = System::Clock::kZero; mWiFiStationReconnectInterval = System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL); mWiFiAPIdleTimeout = System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_WIFI_AP_IDLE_TIMEOUT); diff --git a/src/platform/Tizen/ConnectivityManagerImpl.h b/src/platform/Tizen/ConnectivityManagerImpl.h index d2abb44c348c7e..dc2f7918444da7 100644 --- a/src/platform/Tizen/ConnectivityManagerImpl.h +++ b/src/platform/Tizen/ConnectivityManagerImpl.h @@ -145,7 +145,7 @@ inline bool ConnectivityManagerImpl::_IsWiFiAPApplicationControlled() inline System::Clock::Timeout ConnectivityManagerImpl::_GetWiFiAPIdleTimeout() { - return System::Clock::Zero; + return System::Clock::kZero; } #endif diff --git a/src/platform/android/ConnectivityManagerImpl.cpp b/src/platform/android/ConnectivityManagerImpl.cpp index 114fbcef3d364b..b43c35cdf2a013 100644 --- a/src/platform/android/ConnectivityManagerImpl.cpp +++ b/src/platform/android/ConnectivityManagerImpl.cpp @@ -158,7 +158,7 @@ void ConnectivityManagerImpl::_StopOnDemandWiFiAP() if (mWiFiAPMode == kWiFiAPMode_OnDemand || mWiFiAPMode == kWiFiAPMode_OnDemand_NoStationProvision) { ChipLogProgress(DeviceLayer, "wpa_supplicant: Demand stop WiFi AP"); - mLastAPDemandTime = System::Clock::Zero; + mLastAPDemandTime = System::Clock::kZero; DeviceLayer::SystemLayer().ScheduleWork(DriveAPState, NULL); } else diff --git a/src/platform/tests/TestPlatformMgr.cpp b/src/platform/tests/TestPlatformMgr.cpp index aab3a6652ced72..363efbb81737e1 100644 --- a/src/platform/tests/TestPlatformMgr.cpp +++ b/src/platform/tests/TestPlatformMgr.cpp @@ -202,8 +202,8 @@ static void TestPlatformMgr_MockSystemLayer(nlTestSuite * inSuite, void * inCont NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, &DeviceLayer::SystemLayer() == static_cast(&systemLayer)); - NL_TEST_ASSERT(inSuite, - DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Zero, nullptr, nullptr) == CHIP_APPLICATION_ERROR(1)); + NL_TEST_ASSERT( + inSuite, DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::kZero, nullptr, nullptr) == CHIP_APPLICATION_ERROR(1)); NL_TEST_ASSERT(inSuite, DeviceLayer::SystemLayer().ScheduleWork(nullptr, nullptr) == CHIP_APPLICATION_ERROR(2)); err = PlatformMgr().Shutdown(); diff --git a/src/protocols/bdx/BdxTransferSession.cpp b/src/protocols/bdx/BdxTransferSession.cpp index f49248dbe1cdc3..24c03fc78d316f 100644 --- a/src/protocols/bdx/BdxTransferSession.cpp +++ b/src/protocols/bdx/BdxTransferSession.cpp @@ -361,8 +361,8 @@ void TransferSession::Reset() mLastQueryNum = 0; mNextQueryNum = 0; - mTimeout = System::Clock::Zero; - mTimeoutStartTime = System::Clock::Zero; + mTimeout = System::Clock::kZero; + mTimeoutStartTime = System::Clock::kZero; mShouldInitTimeoutStart = true; mAwaitingResponse = false; } diff --git a/src/protocols/bdx/BdxTransferSession.h b/src/protocols/bdx/BdxTransferSession.h index a33b31a4dbf98b..c2836a866441b9 100644 --- a/src/protocols/bdx/BdxTransferSession.h +++ b/src/protocols/bdx/BdxTransferSession.h @@ -352,8 +352,8 @@ class DLL_EXPORT TransferSession uint32_t mLastQueryNum = 0; uint32_t mNextQueryNum = 0; - System::Clock::Timeout mTimeout = System::Clock::Zero; - System::Clock::Timestamp mTimeoutStartTime = System::Clock::Zero; + System::Clock::Timeout mTimeout = System::Clock::kZero; + System::Clock::Timestamp mTimeoutStartTime = System::Clock::kZero; bool mShouldInitTimeoutStart = true; bool mAwaitingResponse = false; }; diff --git a/src/protocols/bdx/tests/TestBdxTransferSession.cpp b/src/protocols/bdx/tests/TestBdxTransferSession.cpp index 8ed8f02dc67f2c..165b9e0a9c45df 100644 --- a/src/protocols/bdx/tests/TestBdxTransferSession.cpp +++ b/src/protocols/bdx/tests/TestBdxTransferSession.cpp @@ -21,7 +21,7 @@ using namespace ::chip::Protocols; namespace { // Use this as a timestamp if not needing to test BDX timeouts. -constexpr System::Clock::Timestamp kNoAdvanceTime = System::Clock::Zero; +constexpr System::Clock::Timestamp kNoAdvanceTime = System::Clock::kZero; const TLV::Tag tlvStrTag = TLV::ContextTag(4); const TLV::Tag tlvListTag = TLV::ProfileTag(7777, 8888); diff --git a/src/system/SystemClock.h b/src/system/SystemClock.h index d39ab8cf7f4f12..fc74a9601cca02 100644 --- a/src/system/SystemClock.h +++ b/src/system/SystemClock.h @@ -63,7 +63,7 @@ using Seconds64 = std::chrono::duration; using Seconds32 = std::chrono::duration; using Seconds16 = std::chrono::duration; -constexpr Seconds16 Zero{ 0 }; +constexpr Seconds16 kZero{ 0 }; namespace Literals { diff --git a/src/system/SystemLayerImplLibevent.cpp b/src/system/SystemLayerImplLibevent.cpp index 282039490ed4b0..d6ccd0cf2cb298 100644 --- a/src/system/SystemLayerImplLibevent.cpp +++ b/src/system/SystemLayerImplLibevent.cpp @@ -210,7 +210,7 @@ CHIP_ERROR LayerImplLibevent::ScheduleWork(TimerCompleteCallback onComplete, voi assertChipStackLockedByCurrentThread(); VerifyOrReturnError(mLayerState.IsInitialized(), CHIP_ERROR_INCORRECT_STATE); - return StartTimer(Clock::Zero, onComplete, appState); + return StartTimer(Clock::kZero, onComplete, appState); } // static diff --git a/src/system/SystemLayerImplLwIP.cpp b/src/system/SystemLayerImplLwIP.cpp index 8385cec67c1519..5117407cb6ca84 100644 --- a/src/system/SystemLayerImplLwIP.cpp +++ b/src/system/SystemLayerImplLwIP.cpp @@ -56,7 +56,7 @@ CHIP_ERROR LayerImplLwIP::StartTimer(Clock::Timeout delay, TimerCompleteCallback { VerifyOrReturnError(mLayerState.IsInitialized(), CHIP_ERROR_INCORRECT_STATE); - CHIP_SYSTEM_FAULT_INJECT(FaultInjection::kFault_TimeoutImmediate, delay = Clock::Zero); + CHIP_SYSTEM_FAULT_INJECT(FaultInjection::kFault_TimeoutImmediate, delay = Clock::kZero); CancelTimer(onComplete, appState); @@ -91,7 +91,7 @@ CHIP_ERROR LayerImplLwIP::ScheduleWork(TimerCompleteCallback onComplete, void * { VerifyOrReturnError(mLayerState.IsInitialized(), CHIP_ERROR_INCORRECT_STATE); - Timer * timer = Timer::New(*this, System::Clock::Zero, onComplete, appState); + Timer * timer = Timer::New(*this, System::Clock::kZero, onComplete, appState); VerifyOrReturnError(timer != nullptr, CHIP_ERROR_NO_MEMORY); return ScheduleLambda([timer] { timer->HandleComplete(); }); @@ -236,7 +236,7 @@ CHIP_ERROR LayerImplLwIP::HandlePlatformTimer() if (!mTimerList.Empty()) { // timers still exist so restart the platform timer. - Clock::Timeout delay = System::Clock::Zero; + Clock::Timeout delay = System::Clock::kZero; Clock::Timestamp currentTime = SystemClock().GetMonotonicTimestamp(); diff --git a/src/system/SystemLayerImplSelect.cpp b/src/system/SystemLayerImplSelect.cpp index 728b8c017e3f7c..a96077a33e3593 100644 --- a/src/system/SystemLayerImplSelect.cpp +++ b/src/system/SystemLayerImplSelect.cpp @@ -120,7 +120,7 @@ CHIP_ERROR LayerImplSelect::StartTimer(Clock::Timeout delay, TimerCompleteCallba { VerifyOrReturnError(mLayerState.IsInitialized(), CHIP_ERROR_INCORRECT_STATE); - CHIP_SYSTEM_FAULT_INJECT(FaultInjection::kFault_TimeoutImmediate, delay = System::Clock::Zero); + CHIP_SYSTEM_FAULT_INJECT(FaultInjection::kFault_TimeoutImmediate, delay = System::Clock::kZero); CancelTimer(onComplete, appState); @@ -188,7 +188,7 @@ CHIP_ERROR LayerImplSelect::ScheduleWork(TimerCompleteCallback onComplete, void CancelTimer(onComplete, appState); - Timer * timer = Timer::New(*this, Clock::Zero, onComplete, appState); + Timer * timer = Timer::New(*this, Clock::kZero, onComplete, appState); VerifyOrReturnError(timer != nullptr, CHIP_ERROR_NO_MEMORY); #if CHIP_SYSTEM_CONFIG_USE_DISPATCH @@ -339,7 +339,7 @@ void LayerImplSelect::PrepareEvents() awakenTime = timer->AwakenTime(); } - const Clock::Timestamp sleepTime = (awakenTime > currentTime) ? (awakenTime - currentTime) : Clock::Zero; + const Clock::Timestamp sleepTime = (awakenTime > currentTime) ? (awakenTime - currentTime) : Clock::kZero; Clock::ToTimeval(sleepTime, mNextTimeout); mMaxFd = -1; diff --git a/src/system/tests/TestSystemClock.cpp b/src/system/tests/TestSystemClock.cpp index 2e440aa7d4fc02..3b0fc0977cbb18 100644 --- a/src/system/tests/TestSystemClock.cpp +++ b/src/system/tests/TestSystemClock.cpp @@ -90,15 +90,15 @@ void TestMockClock(nlTestSuite * inSuite, void * inContext) public: Clock::Microseconds64 GetMonotonicMicroseconds64() override { return mTime; } Clock::Milliseconds64 GetMonotonicMilliseconds64() override { return mTime; } - Clock::Milliseconds64 mTime = Clock::Zero; + Clock::Milliseconds64 mTime = Clock::kZero; }; MockClock clock; Clock::ClockBase * savedRealClock = &SystemClock(); Clock::Internal::SetSystemClockForTesting(&clock); - NL_TEST_ASSERT(inSuite, SystemClock().GetMonotonicMilliseconds64() == Clock::Zero); - NL_TEST_ASSERT(inSuite, SystemClock().GetMonotonicMicroseconds64() == Clock::Zero); + NL_TEST_ASSERT(inSuite, SystemClock().GetMonotonicMilliseconds64() == Clock::kZero); + NL_TEST_ASSERT(inSuite, SystemClock().GetMonotonicMicroseconds64() == Clock::kZero); constexpr Clock::Milliseconds64 k1234 = Clock::Milliseconds64(1234); clock.mTime = k1234; diff --git a/src/system/tests/TestSystemTimer.cpp b/src/system/tests/TestSystemTimer.cpp index c4b982d67a19af..6a4d0618eedc12 100644 --- a/src/system/tests/TestSystemTimer.cpp +++ b/src/system/tests/TestSystemTimer.cpp @@ -154,7 +154,7 @@ void HandleGreedyTimer(Layer * aLayer, void * aState) return; } - aLayer->StartTimer(chip::System::Clock::Zero, HandleGreedyTimer, aState); + aLayer->StartTimer(chip::System::Clock::kZero, HandleGreedyTimer, aState); sNumTimersHandled++; } @@ -163,7 +163,7 @@ static void CheckStarvation(nlTestSuite * inSuite, void * aContext) TestContext & lContext = *static_cast(aContext); Layer & lSys = *lContext.mLayer; - lSys.StartTimer(chip::System::Clock::Zero, HandleGreedyTimer, aContext); + lSys.StartTimer(chip::System::Clock::kZero, HandleGreedyTimer, aContext); ServiceEvents(lSys); }