diff --git a/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp b/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp index 9a1b2aa408bd59..f3a2d203c824fe 100644 --- a/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp +++ b/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp @@ -925,12 +925,6 @@ bool emberAfTimeSynchronizationClusterSetTimeZoneCallback( } else { - TimeState dstState = TimeSynchronizationServer::Instance().UpdateDSTOffsetState(); - TimeSynchronizationServer::Instance().ClearDSTOffset(); - if (dstState == TimeState::kActive || dstState == TimeState::kChanged) - { - emitDSTStatusEvent(commandPath.mEndpointId, false); - } response.DSTOffsetRequired = true; } } @@ -938,6 +932,17 @@ bool emberAfTimeSynchronizationClusterSetTimeZoneCallback( { response.DSTOffsetRequired = true; } + + if (response.DSTOffsetRequired) + { + TimeState dstState = TimeSynchronizationServer::Instance().UpdateDSTOffsetState(); + TimeSynchronizationServer::Instance().ClearDSTOffset(); + if (dstState == TimeState::kActive || dstState == TimeState::kChanged) + { + emitDSTStatusEvent(commandPath.mEndpointId, false); + } + } + commandObj->AddResponse(commandPath, response); return true; }