Skip to content

Commit

Permalink
Rename System::Clock::Zero to System::Clock::kZero (#11327)
Browse files Browse the repository at this point in the history
#### 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.
  • Loading branch information
kpschoedel authored and pull[bot] committed Oct 4, 2023
1 parent 5a475dc commit 4107759
Show file tree
Hide file tree
Showing 32 changed files with 72 additions and 71 deletions.
2 changes: 1 addition & 1 deletion examples/lock-app/esp32/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/shell/shell_common/cmd_ping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class PingArguments
{
mMaxEchoCount = 3;
mEchoInterval = 1000;
mLastEchoTime = System::Clock::Zero;
mLastEchoTime = System::Clock::kZero;
mEchoCount = 0;
mEchoRespCount = 0;
mPayloadSize = 32;
Expand Down
2 changes: 1 addition & 1 deletion examples/shell/shell_common/cmd_send.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/app/EventManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/tests/integration/MockEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions src/app/tests/integration/chip_im_initiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ chip::TransportMgr<chip::Transport::UDP> 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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ inline bool GenericConnectivityManagerImpl_NoWiFi<ImplClass>::_IsWiFiStationConn
template <class ImplClass>
inline System::Clock::Timeout GenericConnectivityManagerImpl_NoWiFi<ImplClass>::_GetWiFiStationReconnectInterval(void)
{
return System::Clock::Zero;
return System::Clock::kZero;
}

template <class ImplClass>
Expand Down Expand Up @@ -181,7 +181,7 @@ inline void GenericConnectivityManagerImpl_NoWiFi<ImplClass>::_MaintainOnDemandW
template <class ImplClass>
inline System::Clock::Timeout GenericConnectivityManagerImpl_NoWiFi<ImplClass>::_GetWiFiAPIdleTimeout(void)
{
return System::Clock::Zero;
return System::Clock::kZero;
}

template <class ImplClass>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class GenericConnectivityManagerImpl_WiFi
template <class ImplClass>
inline System::Clock::Timeout GenericConnectivityManagerImpl_WiFi<ImplClass>::_GetWiFiStationReconnectInterval()
{
return System::Clock::Zero;
return System::Clock::kZero;
}

template <class ImplClass>
Expand Down Expand Up @@ -167,7 +167,7 @@ inline void GenericConnectivityManagerImpl_WiFi<ImplClass>::_MaintainOnDemandWiF
template <class ImplClass>
inline System::Clock::Timeout GenericConnectivityManagerImpl_WiFi<ImplClass>::_GetWiFiAPIdleTimeout()
{
return System::Clock::Zero;
return System::Clock::kZero;
}

template <class ImplClass>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/dnssd/minimal_mdns/responders/QueryResponder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
11 changes: 6 additions & 5 deletions src/lib/dnssd/minimal_mdns/responders/QueryResponder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/messaging/ExchangeContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/messaging/ReliableMessageMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/messaging/tests/echo/echo_requester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ chip::TransportMgr<chip::Transport::TCP<kMaxTcpActiveConnectionCount, kMaxTcpPen
chip::Inet::IPAddress gDestAddr;

// The last time a CHIP Echo was attempted to be sent.
chip::System::Clock::Timestamp gLastEchoTime = chip::System::Clock::Zero;
chip::System::Clock::Timestamp gLastEchoTime = chip::System::Clock::kZero;

// Count of the number of EchoRequests sent.
uint64_t gEchoCount = 0;
Expand Down Expand Up @@ -263,7 +263,7 @@ int main(int argc, char * argv[])
// Arrange to get a callback whenever an Echo Response is received.
gEchoClient.SetEchoResponseReceived(HandleEchoResponseReceived);

err = chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Zero, EchoTimerHandler, NULL);
err = chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::kZero, EchoTimerHandler, NULL);
SuccessOrExit(err);

chip::DeviceLayer::PlatformMgr().RunEventLoop();
Expand Down
12 changes: 6 additions & 6 deletions src/platform/Ameba/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,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);
}
}
Expand Down Expand Up @@ -334,8 +334,8 @@ CHIP_ERROR ConnectivityManagerImpl::_GetAndLogWifiStatsCounters(void)

CHIP_ERROR ConnectivityManagerImpl::_Init()
{
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;
Expand Down Expand Up @@ -462,7 +462,7 @@ void ConnectivityManagerImpl::DriveStationState()
{
ChangeWiFiStationState(kWiFiStationState_Connected);
ChipLogProgress(DeviceLayer, "WiFi station interface connected");
mLastStationConnectFailTime = System::Clock::Zero;
mLastStationConnectFailTime = System::Clock::kZero;
OnStationConnected();
}

Expand Down Expand Up @@ -499,7 +499,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
Expand All @@ -514,7 +514,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");
Expand Down
14 changes: 7 additions & 7 deletions src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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
Expand All @@ -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");
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/platform/ESP32/PlatformManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
4 changes: 2 additions & 2 deletions src/platform/Linux/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/platform/Linux/PlatformManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
14 changes: 7 additions & 7 deletions src/platform/P6/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
{
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/platform/Tizen/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading

0 comments on commit 4107759

Please sign in to comment.