Nonmonotonicity with CFE_TIME_GetTime #897
Replies: 3 comments
-
|
Tagging @bkolligs |
Beta Was this translation helpful? Give feedback.
-
|
I don't think the CFE_TIME_GetTime has any guarantee of being monotonic. This function calculates a time (which theoretically would correlate to either UTC/TAI depending on what is selected). This calculation is all based on the concept of "Mission Elapsed Time" (MET) which in turn depends on the value of the "Spacecraft Time Correlation Factor" (SCTF) that expresses the difference between the MET and civil calendar. Both these values can be updated via "time at tone" signals. The implementation of CFE TIME is such that updates from the PSP will jump/step the clock, it does not attempt to slew the clock to soften the change. If you want monotonic, use the Also, not sure why this was written in the "sample_app" repo, as it doesn't seem related to sample_app at all. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the reply Joseph, we will test out this function and post updates here. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
The time returned by CFE_TIME_GetTime() is not monotonically increasing.
To Reproduce
Steps to reproduce the behavior:
Create a new app (add the appropriate configuration to startup script and targets.cmake) with the following files:
runner.c:
analyze_time/CMakeLists.txt:
Expected behavior
There should never be any case when a timestamp has the same Seconds but lower Subseconds field than an earlier timestamp.
Code snips
see above
System observed on:
Additional context
The frequency with which the time discrepancy is printed decreases when the input to the usleep() function is increased. Still, there is always one timestamp discrepancy printed regardless of the input to usleep(). We first noticed the behavior while trying to read data from an IMU sending values at roughly 125Hz.
Beta Was this translation helpful? Give feedback.
All reactions