libCom: Fix VxWorks localtime_r() and gmtime_r() wrappers
Wind River changed the return value between VxWorks 6.8 and 6.9.
This commit is contained in:
@@ -67,14 +67,18 @@ void osdNTPReport(void)
|
||||
}
|
||||
|
||||
|
||||
// vxWorks localtime_r interface does not match POSIX standards
|
||||
// vxWorks localtime_r returns different things in different versions.
|
||||
// It can't fail though, so we just ignore the return value.
|
||||
int epicsTime_localtime(const time_t *clock, struct tm *result)
|
||||
{
|
||||
return localtime_r(clock, result) == OK ? epicsTimeOK : epicsTimeERROR;
|
||||
localtime_r(clock, result);
|
||||
return epicsTimeOK;
|
||||
}
|
||||
|
||||
// vxWorks gmtime_r interface does not match POSIX standards
|
||||
// vxWorks gmtime_r returns different things in different versions.
|
||||
// It can't fail though, so we just ignore the return value.
|
||||
int epicsTime_gmtime ( const time_t *pAnsiTime, struct tm *pTM )
|
||||
{
|
||||
return gmtime_r(pAnsiTime, pTM) == OK ? epicsTimeOK : epicsTimeERROR;
|
||||
gmtime_r(pAnsiTime, pTM);
|
||||
return epicsTimeOK;
|
||||
}
|
||||
|
||||
@@ -48,17 +48,23 @@ MAIN(epicsTimeTest)
|
||||
const int wasteTime = 100000;
|
||||
const int nTimes = 10;
|
||||
|
||||
testPlan(16 + nTimes * 18);
|
||||
testPlan(12 + nTimes * 18);
|
||||
|
||||
{
|
||||
try {
|
||||
const epicsTimeStamp epochTS = {0, 0};
|
||||
epicsTime epochET = epochTS;
|
||||
struct gm_tm_nano_sec epicsEpoch = epochET;
|
||||
testOk1(epicsEpoch.ansi_tm.tm_sec == 0);
|
||||
testOk1(epicsEpoch.ansi_tm.tm_min == 0);
|
||||
testOk1(epicsEpoch.ansi_tm.tm_hour == 0);
|
||||
testOk1(epicsEpoch.ansi_tm.tm_yday == 0);
|
||||
testOk1(epicsEpoch.ansi_tm.tm_year == 90);
|
||||
|
||||
testOk(epicsEpoch.ansi_tm.tm_sec == 0 &&
|
||||
epicsEpoch.ansi_tm.tm_min == 0 &&
|
||||
epicsEpoch.ansi_tm.tm_hour == 0 &&
|
||||
epicsEpoch.ansi_tm.tm_yday == 0 &&
|
||||
epicsEpoch.ansi_tm.tm_year == 90,
|
||||
"epicsTime_gmtime() for EPICS epoch");
|
||||
}
|
||||
catch ( ... ) {
|
||||
testFail("epicsTime_gmtime() failed");
|
||||
testAbort("Can't continue, check your OS!");
|
||||
}
|
||||
|
||||
{ // badNanosecTest
|
||||
|
||||
Reference in New Issue
Block a user