Removed osdTime.cpp, cygwin now uses file from posix dir.
This commit is contained in:
@@ -1,102 +0,0 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
//
|
||||
// should move the gettimeofday() proto
|
||||
// into a different header
|
||||
//
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "osiSock.h"
|
||||
#include "cantProceed.h"
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include "epicsTime.h"
|
||||
|
||||
//
|
||||
// epicsTime::osdGetCurrent ()
|
||||
//
|
||||
extern "C" epicsShareFunc int epicsShareAPI epicsTimeGetCurrent (epicsTimeStamp *pDest)
|
||||
{
|
||||
struct timeval current;
|
||||
struct timezone tz;
|
||||
int status = gettimeofday ( & current, & tz );
|
||||
if ( status ) {
|
||||
return epicsTimeERROR;
|
||||
}
|
||||
*pDest = epicsTime ( current );
|
||||
return epicsTimeOK;
|
||||
}
|
||||
|
||||
//
|
||||
// epicsTimeGetEvent ()
|
||||
//
|
||||
extern "C" epicsShareFunc int epicsShareAPI epicsTimeGetEvent (epicsTimeStamp *pDest, int eventNumber)
|
||||
{
|
||||
if (eventNumber==epicsTimeEventCurrentTime) {
|
||||
return epicsTimeGetCurrent (pDest);
|
||||
}
|
||||
return epicsTimeERROR;
|
||||
}
|
||||
|
||||
int epicsTime_gmtime ( const time_t *pAnsiTime, // X aCC 361
|
||||
struct tm *pTM )
|
||||
{
|
||||
struct tm * pRet = gmtime_r ( pAnsiTime, pTM );
|
||||
if ( pRet ) {
|
||||
return epicsTimeOK;
|
||||
}
|
||||
else {
|
||||
return epicsTimeERROR;
|
||||
}
|
||||
}
|
||||
|
||||
int epicsTime_localtime ( const time_t *clock, // X aCC 361
|
||||
struct tm *result )
|
||||
{
|
||||
struct tm * pRet = localtime_r ( clock, result );
|
||||
if ( pRet ) {
|
||||
return epicsTimeOK;
|
||||
}
|
||||
else {
|
||||
return epicsTimeERROR;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" epicsShareFunc void epicsShareAPI
|
||||
convertDoubleToWakeTime(double timeout,struct timespec *wakeTime)
|
||||
{
|
||||
struct timespec wait;
|
||||
|
||||
if(timeout<0.0) timeout = 0.0;
|
||||
else if(timeout>3600.0) timeout = 3600.0;
|
||||
struct timeval current;
|
||||
struct timezone tz;
|
||||
int status = gettimeofday ( & current, & tz );
|
||||
if ( status ) {
|
||||
printf("clock_gettime failed with error %s\n",strerror(errno));
|
||||
cantProceed("convertDoubleToWakeTime");
|
||||
}
|
||||
wakeTime->tv_sec = current.tv_sec;
|
||||
wakeTime->tv_nsec = current.tv_usec * 1000;
|
||||
wait.tv_sec = static_cast < long > ( timeout );
|
||||
wait.tv_nsec = static_cast < long > ( (timeout - (double)wait.tv_sec) * 1e9 );
|
||||
wakeTime->tv_sec += wait.tv_sec;
|
||||
wakeTime->tv_nsec += wait.tv_nsec;
|
||||
if(wakeTime->tv_nsec>1000000000L) {
|
||||
wakeTime->tv_nsec -= 1000000000L;
|
||||
++wakeTime->tv_sec;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user