Skip to content

Conversation

@dzbaker
Copy link
Collaborator

@dzbaker dzbaker commented Jul 11, 2023

Checklist (Please check before submitting)

Describe the contribution
CFE_TIME_Print() calls strftime to format times and returns a status code rather than creating a syslog entry. Note that this may be expanded to allow this to be configurable or parameterized (although EVS may just call strftime directly.)
Re-introduced from #2356. #2388, #2389 reverted this PR.

Also collapsed epoch defines to SECONDS and MICROS for more performance and simpler configuration.

Testing performed
Standard build and UT tests updated.

Expected behavior changes
Function returns CFE_Status_t status.
NOTE strftime uses time_t which may be 32- or 64-bit and may be signed or unsigned, depending on the platform.

System(s) tested on
Ubuntu 22.04LTS

Additional context
https://en.wikipedia.org/w/index.php?title=Time_t&oldid=450752800

Third party code
None.

Contributor Info - All information REQUIRED for consideration of pull request
[email protected]

@dzbaker dzbaker linked an issue Jul 11, 2023 that may be closed by this pull request
@dzbaker dzbaker changed the title fix#2316 - CFE_TIME_Print() calls strftime() fix #2316 - CFE_TIME_Print() calls strftime() Jul 11, 2023
@dzbaker dzbaker requested a review from CDKnightNASA July 11, 2023 15:51

UT_GenStub_Execute(CFE_TIME_Print, Basic, UT_DefaultHandler_CFE_TIME_Print);

return UT_GenStub_GetReturnValue(CFE_TIME_Print, CFE_Status_t);

Check warning

Code scanning / CodeQL

Uses of recursion

The function CFE_TIME_Print is indirectly recursive via this call to [UT_Stub_GetReturnValuePtr](1).
void CFE_TIME_Print(char *PrintBuffer, CFE_TIME_SysTime_t TimeToPrint)
CFE_Status_t CFE_TIME_Print(char *PrintBuffer, CFE_TIME_SysTime_t TimeToPrint)
{
UT_GenStub_SetupReturnBuffer(CFE_TIME_Print, CFE_Status_t);

Check warning

Code scanning / CodeQL

Uses of recursion

The function CFE_TIME_Print is indirectly recursive via this call to [UT_Stub_RegisterReturnType](1).
* ----------------------------------------------------
*/
void CFE_TIME_Print(char *PrintBuffer, CFE_TIME_SysTime_t TimeToPrint)
CFE_Status_t CFE_TIME_Print(char *PrintBuffer, CFE_TIME_SysTime_t TimeToPrint)

Check notice

Code scanning / CodeQL

Long function without assertion

All functions of more than 10 lines should have at least one assertion.
*
*-----------------------------------------------------------------*/
void CFE_TIME_Print(char *PrintBuffer, CFE_TIME_SysTime_t TimeToPrint)
CFE_Status_t CFE_TIME_Print(char *PrintBuffer, CFE_TIME_SysTime_t TimeToPrint)

Check notice

Code scanning / CodeQL

Long function without assertion

All functions of more than 10 lines should have at least one assertion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create CFE_TIME_PrintFmt();

1 participant