Skip to content

Commit

Permalink
Merge branch 'master' into fabric-switch-id
Browse files Browse the repository at this point in the history
  • Loading branch information
arlakshm authored May 8, 2024
2 parents 5d90e14 + 837e467 commit 99e732e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3120,12 +3120,18 @@ void PortsOrch::updateDbPortFlapCount(Port& port, sai_port_oper_status_t pstatus
std::time_t now_c = std::chrono::system_clock::to_time_t(now);
if (pstatus == SAI_PORT_OPER_STATUS_DOWN)
{
FieldValueTuple tuple("last_down_time", std::ctime(&now_c));
char buffer[32];
// Format: Www Mmm dd hh:mm:ss yyyy
std::strftime(buffer, sizeof(buffer), "%a %b %d %H:%M:%S %Y", std::gmtime(&now_c));
FieldValueTuple tuple("last_down_time", buffer);
tuples.push_back(tuple);
}
else if (pstatus == SAI_PORT_OPER_STATUS_UP)
{
FieldValueTuple tuple("last_up_time", std::ctime(&now_c));
char buffer[32];
// Format: Www Mmm dd hh:mm:ss yyyy
std::strftime(buffer, sizeof(buffer), "%a %b %d %H:%M:%S %Y", std::gmtime(&now_c));
FieldValueTuple tuple("last_up_time", buffer);
tuples.push_back(tuple);
}
m_portTable->set(port.m_alias, tuples);
Expand Down

0 comments on commit 99e732e

Please sign in to comment.