Skip to content

Commit

Permalink
Merge pull request #670 from skliper/fix#519-dep-fstime-conversions
Browse files Browse the repository at this point in the history
Fix #519, Deprecate CFS/FS time conversion APIs
  • Loading branch information
astrogeco authored May 8, 2020
2 parents fd802f3 + 306f286 commit 4c392cc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 139 deletions.
16 changes: 11 additions & 5 deletions fsw/cfe-core/src/inc/cfe_time.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ CFE_TIME_Compare_t CFE_TIME_Compare(CFE_TIME_SysTime_t TimeA, CFE_TIME_SysTime_
** \return Spacecraft Time (UTC or TAI) corresponding to the specified MET
**
** \sa #CFE_TIME_GetMET, #CFE_TIME_GetMETseconds, #CFE_TIME_GetMETsubsecs,
** #CFE_TIME_Sub2MicroSecs, #CFE_TIME_Micro2SubSecs, #CFE_TIME_CFE2FSSeconds, #CFE_TIME_FS2CFESeconds
** #CFE_TIME_Sub2MicroSecs, #CFE_TIME_Micro2SubSecs
**
******************************************************************************/
CFE_TIME_SysTime_t CFE_TIME_MET2SCTime (CFE_TIME_SysTime_t METTime);
Expand All @@ -556,7 +556,6 @@ CFE_TIME_SysTime_t CFE_TIME_MET2SCTime (CFE_TIME_SysTime_t METTime);
** \return The equivalent number of microseconds.
**
** \sa #CFE_TIME_MET2SCTime, #CFE_TIME_Micro2SubSecs,
** #CFE_TIME_CFE2FSSeconds, #CFE_TIME_FS2CFESeconds
**
******************************************************************************/
uint32 CFE_TIME_Sub2MicroSecs(uint32 SubSeconds);
Expand All @@ -579,14 +578,17 @@ uint32 CFE_TIME_Sub2MicroSecs(uint32 SubSeconds);
** value is equal to \c 0xffffffff.
**
** \sa #CFE_TIME_MET2SCTime, #CFE_TIME_Sub2MicroSecs,
** #CFE_TIME_CFE2FSSeconds, #CFE_TIME_FS2CFESeconds
**
******************************************************************************/
uint32 CFE_TIME_Micro2SubSecs(uint32 MicroSeconds);

#ifndef CFE_OMIT_DEPRECATED_6_7
/*****************************************************************************/
/**
** \brief Converts cFE seconds into the File System's seconds
** \brief DEPRECATED: Converts cFE seconds into the File System's seconds
** \deprecated Utilize #CFE_FS_Header_t time fields for the creation
** time in mission format, or syncronize local OS time
** with mission time for use with stat command.
**
** \par Description
** File systems use specific time epochs for their time tagging of files.
Expand All @@ -612,7 +614,10 @@ uint32 CFE_TIME_CFE2FSSeconds(uint32 SecondsCFE);

/*****************************************************************************/
/**
** \brief Converts a file system's seconds into cFE seconds
** \brief DEPRECATED: Converts a file system's seconds into cFE seconds
** \deprecated Utilize #CFE_FS_Header_t time fields for the creation
** time in mission format, or syncronize local OS time
** with mission time for use with stat command.
**
** \par Description
** File systems use specific time epochs for their time tagging of files.
Expand All @@ -635,6 +640,7 @@ uint32 CFE_TIME_CFE2FSSeconds(uint32 SecondsCFE);
**
******************************************************************************/
uint32 CFE_TIME_FS2CFESeconds(uint32 SecondsFS);
#endif /* CFE_OMIT_DEPRECATED_6_7 */
/**@}*/

/** @defgroup CFEAPITIMEExternSource cFE External Time Source APIs
Expand Down
4 changes: 2 additions & 2 deletions fsw/cfe-core/src/time/cfe_time_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ uint32 CFE_TIME_Micro2SubSecs(uint32 MicroSeconds)

} /* End of CFE_TIME_Micro2SubSecs() */


#ifndef CFE_OMIT_DEPRECATED_6_7
/*
* Function: CFE_TIME_CFE2FSSeconds - See API and header file for details
*/
Expand Down Expand Up @@ -658,7 +658,7 @@ uint32 CFE_TIME_FS2CFESeconds(uint32 SecondsFS)
return(SecondsCFE);

} /* End of CFE_TIME_FS2CFESeconds() */

#endif /* CFE_OMIT_DEPRECATED_6_7 */

/*
* Function: CFE_TIME_Print - See API and header file for details
Expand Down
111 changes: 0 additions & 111 deletions fsw/cfe-core/unit-test/time_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ void UtTest_Setup(void)
UT_ADD_TEST(Test_GetTime);
UT_ADD_TEST(Test_TimeOp);
UT_ADD_TEST(Test_ConvertTime);
UT_ADD_TEST(Test_ConvertCFEFS);
UT_ADD_TEST(Test_Print);
UT_ADD_TEST(Test_RegisterSyncCallbackTrue);
UT_ADD_TEST(Test_ExternalTone);
Expand Down Expand Up @@ -1146,116 +1145,6 @@ void Test_ConvertTime(void)
"Microseconds exceeds maximum; set maximum subseconds value");
}

/*
** Test function for converting cFE seconds to file system (FS) seconds and
** vice versa
*/
void Test_ConvertCFEFS(void)
{
uint32 result;

#ifdef UT_VERBOSE
UT_Text("Begin Test Convert cFE and FS Seconds\n");
#endif

/* Test cFE to FS conversion using 0 for the cFE seconds value */
UT_InitData();

/* Calculate expected result based on macro value */
if (CFE_MISSION_TIME_FS_FACTOR < 0 && -CFE_MISSION_TIME_FS_FACTOR > 0)
{
result = 0;
}
else
{
result = CFE_MISSION_TIME_FS_FACTOR;
}

UT_Report(__FILE__, __LINE__,
CFE_TIME_CFE2FSSeconds(0) == result,
"CFE_TIME_CFE2FSSeconds",
"Convert 0 cFE seconds to FS seconds");

/* Test cFE to FS conversion using mid-range value for cFE seconds */
UT_InitData();

/* Calculate expected result based on macro value */
if (CFE_MISSION_TIME_FS_FACTOR < 0 && -CFE_MISSION_TIME_FS_FACTOR > 0xffff)
{
result = 0;
}
else
{
result = CFE_MISSION_TIME_FS_FACTOR + 0xffff;
}

UT_Report(__FILE__, __LINE__,
CFE_TIME_CFE2FSSeconds(0xffff) == result,
"CFE_TIME_CFE2FSSeconds",
"Convert mid-range cFE seconds to FS seconds");

/* Test cFE to FS conversion using the maximum cFE seconds value */
UT_InitData();
UT_Report(__FILE__, __LINE__,
CFE_TIME_CFE2FSSeconds(0xffffffff) ==
(uint32) (CFE_MISSION_TIME_FS_FACTOR - 1),
"CFE_TIME_CFE2FSSeconds",
"Maximum cFE seconds value");

/* Test FS to cFE conversion using 0 for the FS seconds value */
UT_InitData();

if (CFE_MISSION_TIME_FS_FACTOR > 0)
{
result = 0;
}
else
{
result = -(uint32) CFE_MISSION_TIME_FS_FACTOR;
}

UT_Report(__FILE__, __LINE__,
CFE_TIME_FS2CFESeconds(0) == result,
"CFE_TIME_FS2CFESeconds",
"Convert 0 FS seconds to cFE seconds");

/* Test FS to cFE conversion response to a FS seconds value that results
* in a negative cFE time (forces cFE seconds to zero)
*/
UT_InitData();
UT_Report(__FILE__, __LINE__,
CFE_TIME_FS2CFESeconds(CFE_MISSION_TIME_FS_FACTOR - 1) == 0,
"CFE_TIME_FS2CFESeconds",
"Negative cFE seconds conversion (force to zero)");

/* Test FS to cFE conversion using the minimum convertible FS
* seconds value
*/
UT_InitData();

if (CFE_MISSION_TIME_FS_FACTOR > (uint32) (CFE_MISSION_TIME_FS_FACTOR + 1))
{
result = 0;
}
else
{
result = 1;
}

UT_Report(__FILE__, __LINE__,
CFE_TIME_FS2CFESeconds(CFE_MISSION_TIME_FS_FACTOR + 1) == result,
"CFE_TIME_FS2CFESeconds",
"Minimum convertible FS seconds value");

/* Test FS to cFE conversion using the maximum FS seconds value */
UT_InitData();
UT_Report(__FILE__, __LINE__,
CFE_TIME_FS2CFESeconds(0xffffffff) == 0xffffffff -
CFE_MISSION_TIME_FS_FACTOR,
"CFE_TIME_FS2CFESeconds",
"Maximum FS seconds value");
}

/*
** Test function for creating a text string representing the date and time
**
Expand Down
21 changes: 0 additions & 21 deletions fsw/cfe-core/unit-test/time_UT.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,27 +153,6 @@ void Test_TimeOp(void);
******************************************************************************/
void Test_ConvertTime(void);

/*****************************************************************************/
/**
** \brief Test function for converting cFE seconds to file system (FS) seconds
** and vice versa
**
** \par Description
** This function tests the function for converting cFE seconds to file
** system (FS) seconds and vice versa.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \returns
** This function does not return a value.
**
** \sa #UT_Text, #UT_InitData, #UT_Report, #CFE_TIME_CFE2FSSeconds,
** \sa #CFE_TIME_FS2CFESeconds
**
******************************************************************************/
void Test_ConvertCFEFS(void);

/*****************************************************************************/
/**
** \brief Test function for creating a text string representing the date
Expand Down

0 comments on commit 4c392cc

Please sign in to comment.