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

Functional test can fail if OS_GetLocalTime and CFE_PSP_GetTime resolution is different #1961

Closed
skliper opened this issue Sep 19, 2021 · 0 comments · Fixed by #1962 or #1967
Closed
Assignees
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Sep 19, 2021

Is your feature request related to a problem? Please describe.
TestGetTime in time_current_test.c uses OS_GetLocalTime to bound the CFE_TIME_GetTime and related calls here:

OS_GetLocalTime(&start);
Time = CFE_TIME_GetTime();
TAI = CFE_TIME_GetTAI();
UTC = CFE_TIME_GetUTC();
MET = CFE_TIME_GetMET();
METSeconds = CFE_TIME_GetMETseconds();
METSubSeconds = CFE_TIME_GetMETsubsecs();
STCF = CFE_TIME_GetSTCF();
LeapSeconds = CFE_TIME_GetLeapSeconds();
OS_GetLocalTime(&end);

OS_GetLocalTime uses clock_gettime here:
https://github.com/nasa/osal/blob/2a2defbb6b5ecc9a0f6d5af96ff73f88edc27327/src/os/portable/os-impl-posix-gettime.c#L78

but the CFE_TIME_GetTime related calls use CFE_PSP_GetTime which for VxWorks uses vxTimeBaseGet here:
https://github.com/nasa/PSP/blob/1bd7bd9508dbe7e0084fc8ad600479c5831d7660/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c#L225

The issue is (at least on VxWorks) if clock_gettime resolution is less than vxTimeBaseGet the test may fail since it can show a difference of zero yet the CFE_TIME_Get* calls may show a difference so the TimeInRange test fails.

Describe the solution you'd like
Use the same utilities and stay in the CFE_TIME_SysTime_t domain by bounding with CFE_TIME_GetTime at the start and the end vs using OS_GetLocalTime. The test is really intended to show that the conversions work correctly to the resolution provided by CFE_TIME_SysTime_t, changing resolutions or references only complicates things unnecessarily leading to possible false results.

Describe alternatives you've considered
None.

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

@skliper skliper self-assigned this Sep 19, 2021
@skliper skliper added this to the 7.0.0 milestone Sep 19, 2021
skliper added a commit to skliper/cFE that referenced this issue Sep 19, 2021
astrogeco added a commit that referenced this issue Sep 21, 2021
Fix #1961, Single time domain in functional time tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant