You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
CFE is directly accessing specific fields within OS_time_t which will break when the struct definition changes.
Describe the solution you'd like
Instead of directly accessing the seconds and microsecs fields within OS_time_t, use the accessor functions to convert/extract the relevant info from the value instead.
Also worth noting here that the CFE_TIME_Micro2SubSecs and CFE_TIME_Sub2MicroSecs are fairly broken. I had never really tested/looked at them with any level of detail until now.
There are plenty of values that do not convert to the "ideal" value. For instance the CFE_TIME unit test uses a microsecond value of "567890", for which CFE_TIME_Micro2SubSecs() returns a value of 0x91614000 ... but the closest value by my calculation 0x91613d32 ... the former converts back to 567890.167236us, but the latter converts back to 567890.0000064us - so much closer to the real value.
Of course in this case when CFE_TIME_Sub2MicroSecs rounds it back to an integer, it returns the same original value (567890) but this isn't always the case.
EXAMPLE: At a value of 568017us, CFE_TIME_Micro2SubSecs() returns a value of 0x91699000 (568017.00592) ... the CFE_TIME_Sub2MicroSecs function then converts this back to 568016, not 568017 as was the original value. (FWIW, by my calculation closest/correct value should actually be 0x91698fe7 here, which is 568017.0001us).
My suggestion is to provide OSAL functions that actually implement this properly.
Instead of accessing OS_time_t values directly, use the
OSAL-provided conversion and access methods. This provides
independence/abstraction from the specific OS_time_t
definition and allows OSAL to transition to a 64 bit value.
Is your feature request related to a problem? Please describe.
CFE is directly accessing specific fields within
OS_time_t
which will break when the struct definition changes.Describe the solution you'd like
Instead of directly accessing the
seconds
andmicrosecs
fields withinOS_time_t
, use the accessor functions to convert/extract the relevant info from the value instead.Additional context
see nasa/osal#429
Requester Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: