-
Notifications
You must be signed in to change notification settings - Fork 206
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 nasa#2316 - adding CFE_TIME_StringFmt() and CFE_TIME_StringFmtLen… #2345
Conversation
Consider returning errors and remove low level |
Copy on the WriteToSysLog, latest revs removes. (Automated tests flagged this as well, nice!) All of the new automated checks are making me do more work. :) Will take out of draft once I've addressed all issues. |
{ | ||
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); | ||
UT_GenStub_Execute(CFE_TIME_Print, Basic, NULL); |
Check warning
Code scanning / CodeQL
Uses of recursion
03b0f20
to
d6eb4e9
Compare
UT_GenStub_Execute(CFE_TIME_Print, Basic, UT_DefaultHandler_CFE_TIME_Print); | ||
UT_GenStub_Execute(CFE_TIME_Print, Basic, NULL); | ||
|
||
return UT_GenStub_GetReturnValue(CFE_TIME_Print, CFE_Status_t); |
Check warning
Code scanning / CodeQL
Uses of recursion
e231851
to
9c6b04c
Compare
9c6b04c
to
57fbacb
Compare
0190725
to
43cfeba
Compare
43cfeba
to
b429d91
Compare
e3b9713
to
56dd61c
Compare
@@ -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
@@ -563,150 +565,28 @@ | |||
* 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
*PrintBuffer++ = '0' + (char)(NumberOfMicros % 10); | ||
*PrintBuffer++ = '\0'; | ||
time_t sec = TimeToPrint.Seconds; | ||
FmtLen = strftime(PrintBuffer, CFE_TIME_PRINTED_STRING_SIZE - 6, "%Y-%j-%H:%M:%S", gmtime(&sec)); |
Check failure
Code scanning / CodeQL
Use of potentially dangerous function
56dd61c
to
0ddf8b8
Compare
…() functions
Checklist (Please check before submitting)
Describe the contribution
Fixes #2316, adds CFE_TIME_StringFmt() and CFE_TIME_StringFmtLen() functions that behave similarly to strftime (but limited to %Y [yyyy], %j [doy], %H, %M, %S, %f [micro]). CFE_TIME_Print() calls CFE_TIME_StringFmt().
Testing performed
Added UT tests, all pass.
Expected behavior changes
No impact to behavior, adds capabilities (that will be extended to EVS so that log message timestamps can be configurable.)
System(s) tested on
Additional context
An alternative would be to use strftime, if all target platforms include it. This would allow for month/day-of-month and other options this code does not include and would be difficult to implement.
Third party code
None
Contributor Info - All information REQUIRED for consideration of pull request
[email protected]