Skip to content

Commit

Permalink
Update examples/all-clusters-app/linux/main-common.cpp
Browse files Browse the repository at this point in the history
Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
yufengwangca and bzbarsky-apple committed Jun 7, 2022
1 parent 85c86de commit b48bced
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions examples/all-clusters-app/linux/main-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,14 @@ void HandleSoftwareFaultEvent(intptr_t arg)
Clusters::SoftwareDiagnostics::Structs::SoftwareFaultStruct::Type softwareFault;
char threadName[kMaxThreadNameLength + 1];

softwareFault.id = static_cast<uint64_t>(gettid());
Platform::CopyString(threadName, kMaxThreadNameLength + 1, std::to_string(softwareFault.id).c_str());
softwareFault.id = static_cast<uint64_t>(getpid());
Platform::CopyString(threadName, std::to_string(softwareFault.id).c_str());

softwareFault.name = CharSpan::fromCharString(threadName);
softwareFault.faultRecording = ByteSpan(Uint8::from_const_char(threadName), strlen(threadName));
softwareFault.name = CharSpan::fromCharString(threadName);

std::time_t result = std::time(nullptr);
char * asctime = std::asctime(std::localtime(&result));
softwareFault.faultRecording = ByteSpan(Uint8::from_const_char(asctime), strlen(asctime));

Clusters::SoftwareDiagnostics::Server::Instance().OnSoftwareFaultDetect(softwareFault);
}
Expand Down

0 comments on commit b48bced

Please sign in to comment.