supported BSD timeval

This commit is contained in:
William Lupton
2000-03-15 00:13:30 +00:00
parent 62dd1dfef8
commit 96f0eea5bd
2 changed files with 35 additions and 0 deletions

View File

@@ -765,6 +765,34 @@ extern "C" {
catch (...) {
return tsStampERROR;
}
# endif
return tsStampOK;
}
epicsShareFunc int epicsShareAPI tsStampToTimeval (struct timeval *pDest, const TS_STAMP *pSrc)
{
# ifdef noExceptionsFromCXX
*pDest = osiTime (*pSrc);
# else
try {
*pDest = osiTime (*pSrc);
}
catch (...) {
return tsStampERROR;
}
# endif
return tsStampOK;
}
epicsShareFunc int epicsShareAPI tsStampFromTimeval (TS_STAMP *pDest, const struct timeval *pSrc)
{
# ifdef noExceptionsFromCXX
*pDest = osiTime (*pSrc);
# else
try {
*pDest = osiTime (*pSrc);
}
catch (...) {
return tsStampERROR;
}
# endif
return tsStampOK;
}

View File

@@ -24,6 +24,7 @@ extern "C" {
#endif /* __cplusplus */
struct timespec;
struct timeval;
#define tsStampOK 0
#define tsStampERROR (-1)
@@ -63,6 +64,12 @@ epicsShareFunc int epicsShareAPI tsStampFromTM (TS_STAMP *pDest, const struct tm
epicsShareFunc int epicsShareAPI tsStampToTimespec (struct timespec *pDest, const TS_STAMP *pSrc);
epicsShareFunc int epicsShareAPI tsStampFromTimespec (TS_STAMP *pDest, const struct timespec *pSrc);
/*
* convert to and from BSD's "struct timeval"
*/
epicsShareFunc int epicsShareAPI tsStampToTimeval (struct timeval *pDest, const TS_STAMP *pSrc);
epicsShareFunc int epicsShareAPI tsStampFromTimeval (TS_STAMP *pDest, const struct timeval *pSrc);
/*
* arithmetic operations
*/