Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #2316 - CFE_TIME_Print() calls strftime() #2390

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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
Christopher.D.Knight@nasa.gov

@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
UT_GenStub_AddParam(CFE_TIME_Print, char *, PrintBuffer);
UT_GenStub_AddParam(CFE_TIME_Print, CFE_TIME_SysTime_t, TimeToPrint);

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).
{
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).
@@ -305,12 +305,16 @@
* Generated stub function for CFE_TIME_Print()
* ----------------------------------------------------
*/
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.
@@ -563,150 +565,30 @@
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
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