Skip to content

Commit

Permalink
Fix nasa#711, Fix bugs found unit testing
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Aug 7, 2020
1 parent c2d4ea0 commit 91d877e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions modules/msg/src/cfe_msg_sechdr_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int32 CFE_MSG_SetMsgTime(CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTime_t NewTime)
CFE_MSG_GetHasSecondaryHeader(MsgPtr, &hassechdr);

status = CFE_MSG_GetType(MsgPtr, &type);
if (status != CFE_SUCCESS || type != CFE_MSG_Type_Cmd || !hassechdr)
if (status != CFE_SUCCESS || type != CFE_MSG_Type_Tlm || !hassechdr)
{
return CFE_MSG_WRONG_MSG_TYPE;
}
Expand Down Expand Up @@ -83,14 +83,15 @@ int32 CFE_MSG_GetMsgTime(const CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTime_t *Ti
CFE_MSG_GetHasSecondaryHeader(MsgPtr, &hassechdr);

status = CFE_MSG_GetType(MsgPtr, &type);
if (status != CFE_SUCCESS || type != CFE_MSG_Type_Cmd || !hassechdr)
if (status != CFE_SUCCESS || type != CFE_MSG_Type_Tlm || !hassechdr)
{
memset(Time, 0, sizeof(*Time));
return CFE_MSG_WRONG_MSG_TYPE;
}

/* Get big endian time fields with default 32/16 layout */
Time->Subseconds = (tlm->Sec.Time[4] << 24) + (tlm->Sec.Time[5] << 16);
Time->Seconds = (tlm->Sec.Time[0] << 24) + (tlm->Sec.Time[1] << 16) + (tlm->Sec.Time[2] << 8) + tlm->Sec.Time[4];
Time->Seconds = (tlm->Sec.Time[0] << 24) + (tlm->Sec.Time[1] << 16) + (tlm->Sec.Time[2] << 8) + tlm->Sec.Time[3];

return CFE_SUCCESS;
}
4 changes: 2 additions & 2 deletions modules/msg/src/cfe_msg_sechdr_time_old.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int32 CFE_MSG_SetMsgTime(CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTime_t NewTime)
CFE_MSG_GetHasSecondaryHeader(MsgPtr, &hassechdr);

status = CFE_MSG_GetType(MsgPtr, &type);
if (status != CFE_SUCCESS || type != CFE_MSG_Type_Cmd || !hassechdr)
if (status != CFE_SUCCESS || type != CFE_MSG_Type_Tlm || !hassechdr)
{
return CFE_MSG_WRONG_MSG_TYPE;
}
Expand Down Expand Up @@ -106,7 +106,7 @@ int32 CFE_MSG_GetMsgTime(const CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTime_t *Ti
CFE_MSG_GetHasSecondaryHeader(MsgPtr, &hassechdr);

status = CFE_MSG_GetType(MsgPtr, &type);
if (status != CFE_SUCCESS || type != CFE_MSG_Type_Cmd || !hassechdr)
if (status != CFE_SUCCESS || type != CFE_MSG_Type_Tlm || !hassechdr)
{
memset(Time, 0, sizeof(*Time));
return CFE_MSG_WRONG_MSG_TYPE;
Expand Down

0 comments on commit 91d877e

Please sign in to comment.