From 6a52eff141210ed6071b31c32a32777bbf553320 Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Wed, 31 Jan 2001 13:34:02 +0000 Subject: [PATCH] osiTime=>epicsTime --- src/as/asDbLib.c | 1 - src/ca/CASG.cpp | 8 +- src/ca/acctst.c | 32 +- src/ca/bhe.cpp | 6 +- src/ca/bhe_IL.h | 2 +- src/ca/caConnTest.cpp | 10 +- src/ca/caEventRate.cpp | 2 +- src/ca/cac.cpp | 16 +- src/ca/casw.cpp | 6 +- src/ca/catime.c | 22 +- src/ca/db_access.h | 16 +- src/ca/evtime.c | 6 +- src/ca/iocinf.h | 12 +- src/cas/example/directoryService/main.cc | 6 +- src/cas/example/directoryService/vxEntry.cc | 11 +- src/cas/example/simple/exPV.cc | 2 +- src/cas/example/simple/exScalarPV.cc | 2 +- src/cas/example/simple/exServer.h | 2 +- src/cas/example/simple/exVectorPV.cc | 2 +- src/cas/example/simple/main.cc | 6 +- src/cas/example/simple/vxEntry.cc | 11 +- src/cas/generic/casDGClient.cc | 4 +- src/cas/generic/casStrmClient.cc | 6 +- src/cas/generic/server.h | 6 +- src/db/callback.c | 1 - src/db/dbAccess.c | 4 +- src/db/dbAccess.h | 2 +- src/db/dbAccessDefs.h | 5 +- src/db/dbBkpt.c | 15 +- src/db/dbBkpt.h | 4 +- src/db/dbCa.c | 8 +- src/db/dbCa.h | 2 +- src/db/dbCaPvt.h | 2 +- src/db/dbCommon.dbd | 2 +- src/db/dbConvert.c | 1 - src/db/dbEvent.c | 1 - src/db/dbFastLinkConv.c | 1 - src/db/dbLock.c | 1 - src/db/dbNotify.c | 1 - src/db/dbPutNotifyBlocker.cpp | 6 +- src/db/dbScan.c | 12 +- src/db/dbTest.c | 1 - src/db/db_access.c | 16 +- src/db/db_field_log.h | 2 +- src/db/recGbl.c | 6 +- src/db/test/callbackTest.c | 16 +- src/dbStatic/dbToRecordtypeH.c | 2 +- src/gdd/aitHelpers.cc | 17 +- src/gdd/aitHelpers.h | 17 +- src/gdd/gdd.h | 9 +- src/gdd/gddI.h | 7 +- src/iocsh/dbBkptRegister.c | 1 - src/libCom/Makefile | 6 +- src/libCom/fdmgr/fdManager.cpp | 2 +- src/libCom/fdmgr/fdManager.h | 2 +- src/libCom/fdmgr/fdmgr.cpp | 4 +- src/libCom/osi/epicsTime.h | 8 +- src/libCom/osi/os/RTEMS/osdTime.cpp | 20 +- src/libCom/osi/os/VMS/osdTime.cpp | 20 +- src/libCom/osi/os/WIN32/osdTime.cpp | 48 +- src/libCom/osi/os/posix/osdEvent.c | 8 +- src/libCom/osi/os/posix/osdMutex.c | 8 +- src/libCom/osi/os/posix/osdTime.cpp | 28 +- src/libCom/osi/os/vxWorks/iocClock.c | 46 +- src/libCom/osi/os/vxWorks/iocClock.h | 8 +- src/libCom/osi/os/vxWorks/osdTime.cpp | 2 +- src/libCom/osi/osiTime.cpp | 866 ------------------ src/libCom/osi/osiTime.h | 388 -------- src/libCom/osi/tsStamp.h | 104 --- src/libCom/test/Makefile | 8 +- src/libCom/test/epicsTimeTest.cpp | 161 ++++ src/libCom/test/epicsTimeTestMain.cpp | 8 + src/libCom/test/fdmgrTest.c | 12 +- src/libCom/test/osiTimeTest.cpp | 172 ---- src/libCom/test/osiTimeTestMain.c | 11 - src/libCom/test/timerTest.c | 14 +- src/libCom/timer/osiTimer.cpp | 12 +- src/libCom/timer/osiTimer.h | 12 +- src/libCom/tsDefs/tsDefs.c | 6 +- src/libCom/tsDefs/tsDefs.h | 2 +- .../top/exampleApp/src/caMonitor.c | 1 - src/misc/iocInit.c | 1 - src/rec/aaiRecord.c | 1 - src/rsrv/camessage.c | 4 +- src/rsrv/camsgtask.c | 4 +- src/rsrv/caserverio.c | 4 +- src/rsrv/caservertask.c | 14 +- src/rsrv/cast_server.c | 10 +- src/rsrv/online_notify.c | 1 - src/rsrv/server.h | 7 +- src/util/ca_test.c | 16 +- src/vxWorks/db/drvTS.c | 5 +- src/vxWorks/db/drvTS.h | 5 +- 93 files changed, 530 insertions(+), 1888 deletions(-) delete mode 100644 src/libCom/osi/osiTime.cpp delete mode 100644 src/libCom/osi/osiTime.h delete mode 100644 src/libCom/osi/tsStamp.h create mode 100644 src/libCom/test/epicsTimeTest.cpp create mode 100644 src/libCom/test/epicsTimeTestMain.cpp delete mode 100644 src/libCom/test/osiTimeTest.cpp delete mode 100644 src/libCom/test/osiTimeTestMain.c diff --git a/src/as/asDbLib.c b/src/as/asDbLib.c index 9199d682f..4f668ce7b 100644 --- a/src/as/asDbLib.c +++ b/src/as/asDbLib.c @@ -32,7 +32,6 @@ of this distribution. #include "caeventmask.h" #include "callback.h" #include "dbStaticLib.h" -#include "tsStamp.h" #include "dbAddr.h" #include "dbAccess.h" #include "db_field_log.h" diff --git a/src/ca/CASG.cpp b/src/ca/CASG.cpp index ce765ad60..d75ef02ec 100644 --- a/src/ca/CASG.cpp +++ b/src/ca/CASG.cpp @@ -72,8 +72,8 @@ bool CASG::verify () const int CASG::block ( double timeout ) { unsigned long initialSeqNo = this->seqNo; - osiTime cur_time; - osiTime beg_time; + epicsTime cur_time; + epicsTime beg_time; double delay; double remaining; int status; @@ -92,7 +92,7 @@ int CASG::block ( double timeout ) epicsThreadPrivateSet (cacRecursionLock, &cacRecursionLock); - cur_time = osiTime::getCurrent (); + cur_time = epicsTime::getCurrent (); this->client.flush (); @@ -133,7 +133,7 @@ int CASG::block ( double timeout ) /* * force a time update */ - cur_time = osiTime::getCurrent (); + cur_time = epicsTime::getCurrent (); delay = cur_time - beg_time; } diff --git a/src/ca/acctst.c b/src/ca/acctst.c index 0edafdf62..d9f19157d 100644 --- a/src/ca/acctst.c +++ b/src/ca/acctst.c @@ -16,7 +16,7 @@ * EPICS */ #include "epicsAssert.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "envDefs.h" /* @@ -1332,18 +1332,18 @@ void arrayTest ( chid chan ) void pend_event_delay_test(dbr_double_t request) { int status; - TS_STAMP end_time; - TS_STAMP start_time; + epicsTimeStamp end_time; + epicsTimeStamp start_time; dbr_double_t delay; dbr_double_t accuracy; - tsStampGetCurrent(&start_time); + epicsTimeGetCurrent(&start_time); status = ca_pend_event(request); if (status != ECA_TIMEOUT) { SEVCHK(status, NULL); } - tsStampGetCurrent(&end_time); - delay = tsStampDiffInSeconds(&end_time,&start_time); + epicsTimeGetCurrent(&end_time); + delay = epicsTimeDiffInSeconds(&end_time,&start_time); accuracy = 100.0*(delay-request)/request; printf("CA pend event delay = %f sec results in error = %f %%\n", request, accuracy); @@ -1354,16 +1354,16 @@ void caTaskExistTest () { int status; - TS_STAMP end_time; - TS_STAMP start_time; + epicsTimeStamp end_time; + epicsTimeStamp start_time; dbr_double_t delay; - tsStampGetCurrent ( &start_time ); + epicsTimeGetCurrent ( &start_time ); printf ( "entering ca_task_exit()\n" ); status = ca_task_exit (); SEVCHK ( status, NULL ); - tsStampGetCurrent ( &end_time ); - delay = tsStampDiffInSeconds ( &end_time, &start_time ); + epicsTimeGetCurrent ( &end_time ); + delay = epicsTimeDiffInSeconds ( &end_time, &start_time ); printf ( "in ca_task_exit() for %f sec\n", delay ); } @@ -1671,20 +1671,20 @@ int acctst ( char *pName, unsigned channelCount, unsigned repetitionCount ) } { - TS_STAMP end_time; - TS_STAMP start_time; + epicsTimeStamp end_time; + epicsTimeStamp start_time; dbr_double_t delay; dbr_double_t request = 15.0; dbr_double_t accuracy; - tsStampGetCurrent(&start_time); + epicsTimeGetCurrent(&start_time); printf ("waiting for events for %f sec\n", request); status = ca_pend_event (request); if ( status != ECA_TIMEOUT ) { SEVCHK ( status, NULL ); } - tsStampGetCurrent ( &end_time ); - delay = tsStampDiffInSeconds ( &end_time, &start_time ); + epicsTimeGetCurrent ( &end_time ); + delay = epicsTimeDiffInSeconds ( &end_time, &start_time ); accuracy = 100.0 * ( delay - request ) / request; printf ( "CA pend event delay accuracy = %f %%\n", accuracy ); } diff --git a/src/ca/bhe.cpp b/src/ca/bhe.cpp index 584c902a5..13c0ad58d 100644 --- a/src/ca/bhe.cpp +++ b/src/ca/bhe.cpp @@ -35,13 +35,13 @@ bhe::~bhe () * * updates beacon period, and looks for beacon anomalies */ -bool bhe::updatePeriod ( osiTime programBeginTime ) +bool bhe::updatePeriod ( epicsTime programBeginTime ) { double currentPeriod; bool netChange = false; - osiTime current = osiTime::getCurrent (); + epicsTime current = epicsTime::getCurrent (); - if ( this->timeStamp == osiTime () ) { + if ( this->timeStamp == epicsTime () ) { if ( this->piiu ) { this->piiu->beaconAnomalyNotify (); diff --git a/src/ca/bhe_IL.h b/src/ca/bhe_IL.h index bc8c19f9a..49cee5831 100644 --- a/src/ca/bhe_IL.h +++ b/src/ca/bhe_IL.h @@ -25,7 +25,7 @@ * zero (so we can correctly compute the period * between the 1st and 2nd beacons) */ -inline bhe::bhe ( const osiTime &initialTimeStamp, const inetAddrID &addr ) : +inline bhe::bhe ( const epicsTime &initialTimeStamp, const inetAddrID &addr ) : inetAddrID (addr), piiu (0), timeStamp (initialTimeStamp), averagePeriod (-1.0) { # ifdef DEBUG diff --git a/src/ca/caConnTest.cpp b/src/ca/caConnTest.cpp index 6f1bb3a82..8d9a4b5a3 100644 --- a/src/ca/caConnTest.cpp +++ b/src/ca/caConnTest.cpp @@ -4,13 +4,13 @@ #include "cadef.h" #include "epicsAssert.h" -#include "osiTime.h" +#include "epicsTime.h" static unsigned channelCount = 0u; static unsigned connCount = 0u; static bool subsequentConnect = false; -osiTime begin; +epicsTime begin; extern "C" void caConnTestConnHandler ( struct connection_handler_args args ) { @@ -18,14 +18,14 @@ extern "C" void caConnTestConnHandler ( struct connection_handler_args args ) if ( connCount == 0u ) { if ( subsequentConnect ) { printf ("the first channel connected\n"); - begin = osiTime::getCurrent (); + begin = epicsTime::getCurrent (); } } connCount++; // printf ( "." ); // fflush ( stdout ); if ( connCount == channelCount ) { - osiTime current = osiTime::getCurrent (); + epicsTime current = epicsTime::getCurrent (); double delay = current - begin; printf ( "all channels connected after %f sec ( %f sec per channel)\n", delay, delay / channelCount ); @@ -61,7 +61,7 @@ void caConnTest ( const char *pNameIn, unsigned channelCountIn, double delayIn ) while ( 1 ) { connCount = 0u; subsequentConnect = false; - begin = osiTime::getCurrent (); + begin = epicsTime::getCurrent (); printf ( "initializing CA client library\n" ); diff --git a/src/ca/caEventRate.cpp b/src/ca/caEventRate.cpp index 57c1bd015..1b3da53aa 100644 --- a/src/ca/caEventRate.cpp +++ b/src/ca/caEventRate.cpp @@ -7,7 +7,7 @@ #include "cadef.h" #include "dbDefs.h" -#include "tsStamp.h" +#include "epicsTime.h" /* * event_handler() diff --git a/src/ca/cac.cpp b/src/ca/cac.cpp index f249a9212..0d6adc4bb 100644 --- a/src/ca/cac.cpp +++ b/src/ca/cac.cpp @@ -106,7 +106,7 @@ cac::cac ( bool enablePreemptiveCallbackIn ) : strncpy ( this->pUserName, tmp, len ); } - this->programBeginTime = osiTime::getCurrent (); + this->programBeginTime = epicsTime::getCurrent (); status = envGetDoubleConfigParam ( &EPICS_CA_CONN_TMO, &this->connTMO ); if ( status ) { @@ -412,7 +412,7 @@ bhe * cac::lookupBeaconInetAddr (const inetAddrID &ina) /* * cac::createBeaconHashEntry () */ -bhe *cac::createBeaconHashEntry (const inetAddrID &ina, const osiTime &initialTimeStamp) +bhe *cac::createBeaconHashEntry (const inetAddrID &ina, const epicsTime &initialTimeStamp) { epicsAutoMutex autoMutex ( this->defaultMutex ); bhe *pBHE; @@ -461,7 +461,7 @@ void cac::beaconNotify ( const inetAddrID &addr ) * shortly after the program started up) */ netChange = FALSE; - this->createBeaconHashEntry ( addr, osiTime::getCurrent () ); + this->createBeaconHashEntry ( addr, epicsTime::getCurrent () ); } if ( ! netChange ) { @@ -548,8 +548,8 @@ int cac::pend ( double timeout, int early ) */ int cac::pendPrivate (double timeout, int early) { - osiTime cur_time; - osiTime beg_time; + epicsTime cur_time; + epicsTime beg_time; double delay; this->flush (); @@ -568,7 +568,7 @@ int cac::pendPrivate (double timeout, int early) return ECA_TIMEOUT; } - beg_time = cur_time = osiTime::getCurrent (); + beg_time = cur_time = epicsTime::getCurrent (); delay = 0.0; while ( true ) { @@ -603,7 +603,7 @@ int cac::pendPrivate (double timeout, int early) return ECA_NORMAL; } - cur_time = osiTime::getCurrent (); + cur_time = epicsTime::getCurrent (); if ( timeout != 0.0 ) { delay = cur_time - beg_time; @@ -929,7 +929,7 @@ tcpiiu * cac::constructTCPIIU ( const osiSockAddr &addr, unsigned minorVersion ) } } else { - pBHE = this->createBeaconHashEntry ( addr.ia, osiTime () ); + pBHE = this->createBeaconHashEntry ( addr.ia, epicsTime () ); if ( ! pBHE ) { return NULL; } diff --git a/src/ca/casw.cpp b/src/ca/casw.cpp index 39ae04920..8b7d4b9e7 100644 --- a/src/ca/casw.cpp +++ b/src/ca/casw.cpp @@ -18,7 +18,7 @@ int main ( int argc, char **argv ) { - osiTime programBeginTime = osiTime::getCurrent (); + epicsTime programBeginTime = epicsTime::getCurrent (); SOCKET sock; osiSockAddr addr; osiSocklen_t addrSize; @@ -164,7 +164,7 @@ int main ( int argc, char **argv ) * shortly after the program started up) */ netChange = false; - pBHE = new bhe ( osiTime::getCurrent (), ina ); + pBHE = new bhe ( epicsTime::getCurrent (), ina ); if ( pBHE ) { if ( beaconTable.add ( *pBHE ) < 0 ) { pBHE->destroy (); @@ -174,7 +174,7 @@ int main ( int argc, char **argv ) if ( netChange ) { char date[64]; - osiTime current = osiTime::getCurrent (); + epicsTime current = epicsTime::getCurrent (); current.strftime ( date, sizeof ( date ), "%a %b %d %Y %H:%M:%S"); char host[64]; ipAddrToA ( &ina, host, sizeof ( host ) ); diff --git a/src/ca/catime.c b/src/ca/catime.c index 2b8ae81fb..ae003330e 100644 --- a/src/ca/catime.c +++ b/src/ca/catime.c @@ -19,7 +19,7 @@ #include "epicsAssert.h" #include "cadef.h" #include "caProto.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "caDiagnostics.h" @@ -348,8 +348,8 @@ unsigned *pInlineIter */ LOCAL void measure_get_latency (ti *pItems, unsigned iterations) { - TS_STAMP end_time; - TS_STAMP start_time; + epicsTimeStamp end_time; + epicsTimeStamp start_time; double delay; double X = 0u; double XX = 0u; @@ -361,16 +361,16 @@ LOCAL void measure_get_latency (ti *pItems, unsigned iterations) int status; for (pi=pItems; pi<&pItems[iterations]; pi++) { - tsStampGetCurrent (&start_time); + epicsTimeGetCurrent (&start_time); status = ca_array_get (pi->type, pi->count, pi->chix, &pi->val); SEVCHK (status, NULL); status = ca_pend_io (100.0); SEVCHK (status, NULL); - tsStampGetCurrent(&end_time); + epicsTimeGetCurrent(&end_time); - delay = tsStampDiffInSeconds(&end_time,&start_time); + delay = epicsTimeDiffInSeconds(&end_time,&start_time); X += delay; XX += delay*delay; @@ -426,15 +426,15 @@ LOCAL void printSearchStat ( const ti *pi, unsigned iterations ) */ void timeIt ( tf *pfunc, ti *pItems, unsigned iterations, unsigned nBytes ) { - TS_STAMP end_time; - TS_STAMP start_time; + epicsTimeStamp end_time; + epicsTimeStamp start_time; double delay; unsigned inlineIter; - tsStampGetCurrent (&start_time); + epicsTimeGetCurrent (&start_time); (*pfunc) (pItems, iterations, &inlineIter); - tsStampGetCurrent (&end_time); - delay = tsStampDiffInSeconds (&end_time, &start_time); + epicsTimeGetCurrent (&end_time); + delay = epicsTimeDiffInSeconds (&end_time, &start_time); if (delay>0.0) { printf ("Elapsed Per Item = %12.8f sec, %10.1f Items per sec", delay/(iterations*inlineIter), (iterations*inlineIter)/delay); diff --git a/src/ca/db_access.h b/src/ca/db_access.h index a16da7d7b..5b3be92b7 100644 --- a/src/ca/db_access.h +++ b/src/ca/db_access.h @@ -84,7 +84,7 @@ of this distribution. #include "shareLib.h" #include "epicsTypes.h" -#include "tsStamp.h" +#include "epicsTime.h" #ifdef __cplusplus extern "C" { @@ -303,7 +303,7 @@ struct dbr_sts_double{ struct dbr_time_string{ dbr_short_t status; /* status of value */ dbr_short_t severity; /* severity of alarm */ - TS_STAMP stamp; /* time stamp */ + epicsTimeStamp stamp; /* time stamp */ dbr_string_t value; /* current value */ }; @@ -311,7 +311,7 @@ struct dbr_time_string{ struct dbr_time_short{ dbr_short_t status; /* status of value */ dbr_short_t severity; /* severity of alarm */ - TS_STAMP stamp; /* time stamp */ + epicsTimeStamp stamp; /* time stamp */ dbr_short_t RISC_pad; /* RISC alignment */ dbr_short_t value; /* current value */ }; @@ -320,7 +320,7 @@ struct dbr_time_short{ struct dbr_time_float{ dbr_short_t status; /* status of value */ dbr_short_t severity; /* severity of alarm */ - TS_STAMP stamp; /* time stamp */ + epicsTimeStamp stamp; /* time stamp */ dbr_float_t value; /* current value */ }; @@ -328,7 +328,7 @@ struct dbr_time_float{ struct dbr_time_enum{ dbr_short_t status; /* status of value */ dbr_short_t severity; /* severity of alarm */ - TS_STAMP stamp; /* time stamp */ + epicsTimeStamp stamp; /* time stamp */ dbr_short_t RISC_pad; /* RISC alignment */ dbr_enum_t value; /* current value */ }; @@ -337,7 +337,7 @@ struct dbr_time_enum{ struct dbr_time_char{ dbr_short_t status; /* status of value */ dbr_short_t severity; /* severity of alarm */ - TS_STAMP stamp; /* time stamp */ + epicsTimeStamp stamp; /* time stamp */ dbr_short_t RISC_pad0; /* RISC alignment */ dbr_char_t RISC_pad1; /* RISC alignment */ dbr_char_t value; /* current value */ @@ -347,7 +347,7 @@ struct dbr_time_char{ struct dbr_time_long{ dbr_short_t status; /* status of value */ dbr_short_t severity; /* severity of alarm */ - TS_STAMP stamp; /* time stamp */ + epicsTimeStamp stamp; /* time stamp */ dbr_long_t value; /* current value */ }; @@ -355,7 +355,7 @@ struct dbr_time_long{ struct dbr_time_double{ dbr_short_t status; /* status of value */ dbr_short_t severity; /* severity of alarm */ - TS_STAMP stamp; /* time stamp */ + epicsTimeStamp stamp; /* time stamp */ dbr_long_t RISC_pad; /* RISC alignment */ dbr_double_t value; /* current value */ }; diff --git a/src/ca/evtime.c b/src/ca/evtime.c index 40342b206..5b73bc88b 100644 --- a/src/ca/evtime.c +++ b/src/ca/evtime.c @@ -2,7 +2,7 @@ #include #include "cadef.h" #include "dbDefs.h" -#include "tsStamp.h" +#include "epicsTime.h" void event_handler (struct event_handler_args args); int evtime (char *pname); @@ -66,10 +66,10 @@ void event_handler(struct event_handler_args args) # define COUNT 0x8000 double interval; double delay; - TS_STAMP ts; + epicsTimeStamp ts; if(iteration_count%COUNT == 0){ - tsStampGetCurrent(&ts); + epicsTimeGetCurrent(&ts); current_time = ts.secPastEpoch; if(last_time != 0){ interval = current_time - last_time; diff --git a/src/ca/iocinf.h b/src/ca/iocinf.h index 55a79975e..f5bb9b89d 100644 --- a/src/ca/iocinf.h +++ b/src/ca/iocinf.h @@ -40,7 +40,7 @@ #include "bucketLib.h" #include "envDefs.h" #include "epicsPrint.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "tsFreeList.h" #include "tsDLList.h" #include "osiSock.h" @@ -883,11 +883,11 @@ private: class bhe : public tsSLNode < bhe >, public inetAddrID { public: - epicsShareFunc bhe ( const osiTime &initialTimeStamp, const inetAddrID &addr ); + epicsShareFunc bhe ( const epicsTime &initialTimeStamp, const inetAddrID &addr ); tcpiiu *getIIU () const; void bindToIIU ( tcpiiu & ); epicsShareFunc void destroy (); - epicsShareFunc bool updatePeriod ( osiTime programBeginTime ); + epicsShareFunc bool updatePeriod ( epicsTime programBeginTime ); epicsShareFunc double period () const; epicsShareFunc void show ( unsigned level) const; epicsShareFunc void * operator new ( size_t size ); @@ -895,7 +895,7 @@ public: private: tcpiiu *piiu; - osiTime timeStamp; + epicsTime timeStamp; double averagePeriod; static tsFreeList < class bhe, 1024 > freeList; @@ -1067,7 +1067,7 @@ public: void beaconNotify ( const inetAddrID &addr ); bhe *lookupBeaconInetAddr ( const inetAddrID &ina ); bhe *createBeaconHashEntry ( const inetAddrID &ina, - const osiTime &initialTimeStamp ); + const epicsTime &initialTimeStamp ); void repeaterSubscribeConfirmNotify (); // IIU routines @@ -1134,7 +1134,7 @@ private: < CASG > sgTable; resTable < bhe, inetAddrID > beaconTable; - osiTime programBeginTime; + epicsTime programBeginTime; double connTMO; // defaultMutex can be applied if iiuListMutex is already applied mutable epicsMutex defaultMutex; diff --git a/src/cas/example/directoryService/main.cc b/src/cas/example/directoryService/main.cc index 745cbbc11..e8915acd4 100644 --- a/src/cas/example/directoryService/main.cc +++ b/src/cas/example/directoryService/main.cc @@ -23,7 +23,7 @@ LOCAL int parseDirectoryFP (FILE *pf, const char *pFileName); // extern int main (int argc, const char **argv) { - osiTime begin(osiTime::getCurrent()); + epicsTime begin(epicsTime::getCurrent()); directoryServer *pCAS; unsigned debugLevel = 0u; double executionTime; @@ -82,14 +82,14 @@ extern int main (int argc, const char **argv) } } else { - double delay = osiTime::getCurrent() - begin; + double delay = epicsTime::getCurrent() - begin; // // loop here untime the specified execution time // expires // while (delay < executionTime) { fileDescriptorManager.process (delay); - delay = osiTime::getCurrent() - begin; + delay = epicsTime::getCurrent() - begin; } } pCAS->show(2u); diff --git a/src/cas/example/directoryService/vxEntry.cc b/src/cas/example/directoryService/vxEntry.cc index c7bce818a..621910e8b 100644 --- a/src/cas/example/directoryService/vxEntry.cc +++ b/src/cas/example/directoryService/vxEntry.cc @@ -3,6 +3,9 @@ // Author: Jeff HIll (LANL) // // $Log$ +// Revision 1.1 1997/06/13 09:20:26 jhill +// installed +// // Revision 1.2 1997/04/10 19:39:26 jhill // API changes // @@ -32,7 +35,7 @@ exServer *pExampleCAS; // int excas (unsigned debugLevel, unsigned delaySec) { - osiTime begin(osiTime::getCurrent()); + epicsTime begin(epicsTime::getCurrent()); exServer *pCAS; pCAS = new exServer(32u,5u,500u); @@ -52,15 +55,15 @@ int excas (unsigned debugLevel, unsigned delaySec) } } else { - osiTime total( ((float)delaySec) ); - osiTime delay(osiTime::getCurrent() - begin); + epicsTime total( ((float)delaySec) ); + epicsTime delay(epicsTime::getCurrent() - begin); // // loop here untill the specified execution time // expires // while (delay < total) { taskDelay(10); - delay = osiTime::getCurrent() - begin; + delay = epicsTime::getCurrent() - begin; } } pCAS->show(debugLevel); diff --git a/src/cas/example/simple/exPV.cc b/src/cas/example/simple/exPV.cc index b1c606555..8647db3b2 100644 --- a/src/cas/example/simple/exPV.cc +++ b/src/cas/example/simple/exPV.cc @@ -9,7 +9,7 @@ // char exPV::hasBeenInitialized = 0; gddAppFuncTable exPV::ft; -osiTime exPV::currentTime; +epicsTime exPV::currentTime; // // special gddDestructor guarantees same form of new and delete diff --git a/src/cas/example/simple/exScalarPV.cc b/src/cas/example/simple/exScalarPV.cc index e58ab0521..dec6af858 100644 --- a/src/cas/example/simple/exScalarPV.cc +++ b/src/cas/example/simple/exScalarPV.cc @@ -40,7 +40,7 @@ void exScalarPV::scan() // throughput under sunos4 because gettimeofday() is // slow) // - this->currentTime = osiTime::getCurrent(); + this->currentTime = epicsTime::getCurrent(); pDD = new gddScalar (gddAppType_value, aitEnumFloat64); if ( ! pDD.valid () ) { diff --git a/src/cas/example/simple/exServer.h b/src/cas/example/simple/exServer.h index 97c8e9588..a30a333f2 100644 --- a/src/cas/example/simple/exServer.h +++ b/src/cas/example/simple/exServer.h @@ -247,7 +247,7 @@ protected: bool interest; bool preCreate; bool scanOn; - static osiTime currentTime; + static epicsTime currentTime; virtual caStatus updateValue (smartConstGDDPointer pValue) = 0; diff --git a/src/cas/example/simple/exVectorPV.cc b/src/cas/example/simple/exVectorPV.cc index 1d4aa2470..669d01e0f 100644 --- a/src/cas/example/simple/exVectorPV.cc +++ b/src/cas/example/simple/exVectorPV.cc @@ -67,7 +67,7 @@ void exVectorPV::scan() // throughput under sunos4 because gettimeofday() is // slow) // - this->currentTime = osiTime::getCurrent(); + this->currentTime = epicsTime::getCurrent(); pDD = new gddAtomic (gddAppType_value, aitEnumFloat64, 1u, this->info.getElementCount()); diff --git a/src/cas/example/simple/main.cc b/src/cas/example/simple/main.cc index 07ab5e987..a6175e14b 100644 --- a/src/cas/example/simple/main.cc +++ b/src/cas/example/simple/main.cc @@ -8,7 +8,7 @@ // extern int main (int argc, const char **argv) { - osiTime begin (osiTime::getCurrent()); + epicsTime begin (epicsTime::getCurrent()); exServer *pCAS; unsigned debugLevel = 0u; double executionTime; @@ -67,14 +67,14 @@ extern int main (int argc, const char **argv) } } else { - double delay = osiTime::getCurrent() - begin; + double delay = epicsTime::getCurrent() - begin; // // loop here untill the specified execution time // expires // while (delay < executionTime) { fileDescriptorManager.process(delay); - delay = osiTime::getCurrent() - begin; + delay = epicsTime::getCurrent() - begin; } } pCAS->show(2u); diff --git a/src/cas/example/simple/vxEntry.cc b/src/cas/example/simple/vxEntry.cc index 2337be540..9d0e627e1 100644 --- a/src/cas/example/simple/vxEntry.cc +++ b/src/cas/example/simple/vxEntry.cc @@ -3,6 +3,9 @@ // Author: Jeff HIll (LANL) // // $Log$ +// Revision 1.2 1997/04/10 19:39:26 jhill +// API changes +// // Revision 1.1 1996/12/06 22:20:22 jhill // moved down one level // @@ -29,7 +32,7 @@ exServer *pExampleCAS; // int excas (unsigned debugLevel, unsigned delaySec) { - osiTime begin(osiTime::getCurrent()); + epicsTime begin(epicsTime::getCurrent()); exServer *pCAS; pCAS = new exServer(32u,5u,500u); @@ -49,15 +52,15 @@ int excas (unsigned debugLevel, unsigned delaySec) } } else { - osiTime total( ((float)delaySec) ); - osiTime delay(osiTime::getCurrent() - begin); + epicsTime total( ((float)delaySec) ); + epicsTime delay(epicsTime::getCurrent() - begin); // // loop here untill the specified execution time // expires // while (delay < total) { taskDelay(10); - delay = osiTime::getCurrent() - begin; + delay = epicsTime::getCurrent() - begin; } } pCAS->show(debugLevel); diff --git a/src/cas/generic/casDGClient.cc b/src/cas/generic/casDGClient.cc index 5286d62ab..c6257b2a9 100644 --- a/src/cas/generic/casDGClient.cc +++ b/src/cas/generic/casDGClient.cc @@ -392,7 +392,7 @@ outBuf::flushCondition casDGClient::xSend (char *pBufIn, // // !! this time fetch may be slowing things down !! // - //this->lastSendTS = osiTime::getCurrent(); + //this->lastSendTS = epicsTime::getCurrent(); nBytesSent = totalBytes; return outBuf::flushProgress; } @@ -423,7 +423,7 @@ inBuf::fillCondition casDGClient::xRecv (char *pBufIn, bufSizeT nBytesToRecv, // // !! this time fetch may be slowing things down !! // - //this->lastRecvTS = osiTime::getCurrent(); + //this->lastRecvTS = epicsTime::getCurrent(); } else { break; diff --git a/src/cas/generic/casStrmClient.cc b/src/cas/generic/casStrmClient.cc index e7cc6caab..5dec128e9 100644 --- a/src/cas/generic/casStrmClient.cc +++ b/src/cas/generic/casStrmClient.cc @@ -2048,7 +2048,7 @@ outBuf::flushCondition casStrmClient::xSend (char *pBufIn, bufSizeT nBytesAvaila // // !! this time fetch may be slowing things down !! // - //this->lastSendTS = osiTime::getCurrent(); + //this->lastSendTS = epicsTime::getCurrent(); return outBuf::flushProgress; } else { @@ -2062,7 +2062,7 @@ outBuf::flushCondition casStrmClient::xSend (char *pBufIn, bufSizeT nBytesAvaila // // !! this time fetch may be slowing things down !! // - //this->lastSendTS = osiTime::getCurrent(); + //this->lastSendTS = epicsTime::getCurrent(); nActualBytes = totalBytes; return outBuf::flushProgress; } @@ -2081,7 +2081,7 @@ inBuf::fillCondition casStrmClient::xRecv(char *pBufIn, bufSizeT nBytes, // // this is used to set the time stamp for write GDD's // - this->lastRecvTS = osiTime::getCurrent(); + this->lastRecvTS = epicsTime::getCurrent(); return stat; } diff --git a/src/cas/generic/server.h b/src/cas/generic/server.h index 063e850a9..9d0f78405 100644 --- a/src/cas/generic/server.h +++ b/src/cas/generic/server.h @@ -50,7 +50,7 @@ #undef epicsAssertAuthor #define epicsAssertAuthor "Jeff Hill johill@lanl.gov" #include "epicsAssert.h" // EPICS assert() macros -#include "osiTime.h" // EPICS os independent time +#include "epicsTime.h" // EPICS os independent time #include "alarm.h" // EPICS alarm severity/condition #include "errMdef.h" // EPICS error codes #include "resourceLib.h" // EPICS hashing templates @@ -500,8 +500,8 @@ public: protected: unsigned minor_version_number; - osiTime lastSendTS; - osiTime lastRecvTS; + epicsTime lastSendTS; + epicsTime lastRecvTS; caStatus sendErrWithEpicsStatus(const caHdr *pMsg, caStatus epicsStatus, caStatus clientStatus); diff --git a/src/db/callback.c b/src/db/callback.c index 45c38eb18..cbac51d9f 100644 --- a/src/db/callback.c +++ b/src/db/callback.c @@ -23,7 +23,6 @@ of this distribution. #include "epicsInterrupt.h" #include "osiTimer.h" #include "epicsRingPointer.h" -#include "tsStamp.h" #include "errlog.h" #include "dbStaticLib.h" #include "dbBase.h" diff --git a/src/db/dbAccess.c b/src/db/dbAccess.c index 19877969f..e922697a1 100644 --- a/src/db/dbAccess.c +++ b/src/db/dbAccess.c @@ -50,7 +50,7 @@ of this distribution. #include "errlog.h" #include "cantProceed.h" #include "cvtFast.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "alarm.h" #include "ellLib.h" #include "dbStaticLib.h" @@ -1347,7 +1347,7 @@ long epicsShareAPI dbGetSevr(struct link *plink,short *severity) return(0); } -long epicsShareAPI dbGetTimeStamp(struct link *plink,TS_STAMP *pstamp) +long epicsShareAPI dbGetTimeStamp(struct link *plink,epicsTimeStamp *pstamp) { DBADDR *paddr; diff --git a/src/db/dbAccess.h b/src/db/dbAccess.h index d4b81c670..2d40142bb 100644 --- a/src/db/dbAccess.h +++ b/src/db/dbAccess.h @@ -15,7 +15,7 @@ of this distribution. #define INCdbAccessh #include "dbDefs.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "caeventmask.h" #include "dbFldTypes.h" #include "link.h" diff --git a/src/db/dbAccessDefs.h b/src/db/dbAccessDefs.h index 267f64728..c85c9c450 100644 --- a/src/db/dbAccessDefs.h +++ b/src/db/dbAccessDefs.h @@ -30,6 +30,7 @@ of this distribution. #ifndef INCdbAccessDefsh #define INCdbAccessDefsh +#include "epicsTime.h" #include "shareLib.h" #ifdef __cplusplus extern "C" { @@ -116,7 +117,7 @@ epicsShareExtern volatile int interruptAccept; long precision; /* number of decimal places*/\ long field_width; /* field width */ #define DBRtime \ - TS_STAMP time; /* time stamp*/ + epicsTimeStamp time; /* time stamp*/ #define DBRenumStrs \ unsigned long no_str; /* number of strings*/\ long padenumStrs; /*padding to force 8 byte align*/\ @@ -262,7 +263,7 @@ epicsShareFunc long epicsShareAPI dbGetUnits( epicsShareFunc long epicsShareAPI dbGetSevr( struct link *plink,short *severity); epicsShareFunc long epicsShareAPI dbGetTimeStamp( - struct link *plink,TS_STAMP *pstamp); + struct link *plink,epicsTimeStamp *pstamp); typedef void(*SPC_ASCALLBACK)(struct dbCommon *); /*dbSpcAsRegisterCallback called by access security */ diff --git a/src/db/dbBkpt.c b/src/db/dbBkpt.c index 0f96b8f9a..d6bc9f4de 100644 --- a/src/db/dbBkpt.c +++ b/src/db/dbBkpt.c @@ -14,6 +14,9 @@ of this distribution. /* Modification Log: * ----------------- * $Log$ + * Revision 1.26 2001/01/18 19:07:49 mrk + * changes for osiThread=>epicsThread + * * Revision 1.25 2001/01/12 00:27:16 jhill * fixed bugs introduced by APS's osi => epics name changes * @@ -54,7 +57,7 @@ of this distribution. * new way to build * * Revision 1.12 2000/01/04 20:26:16 mrk - * replace osiClock calls with tsStamp calls + * replace osiClock calls with epicsTime calls * * Revision 1.11 1999/12/14 22:01:33 mrk * changes for osiSem changes @@ -113,7 +116,7 @@ of this distribution. #include "epicsThread.h" #include "epicsMutex.h" #include "epicsEvent.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "ellLib.h" #include "errlog.h" #include "alarm.h" @@ -779,7 +782,7 @@ int epicsShareAPI dbBkpt(dbCommon *precord) pqe->entrypoint = precord; pqe->count = 1; - tsStampGetCurrent(&pqe->time); + epicsTimeGetCurrent(&pqe->time); pqe->sched = 0; #ifdef BKPT_DIAG @@ -945,11 +948,11 @@ long epicsShareAPI dbstat(void) struct LS_LIST *pnode; struct BP_LIST *pbl; struct EP_LIST *pqe; - TS_STAMP time; + epicsTimeStamp time; epicsMutexMustLock(bkpt_stack_sem); - tsStampGetCurrent(&time); + epicsTimeGetCurrent(&time); /* * Traverse list, reporting stopped records @@ -964,7 +967,7 @@ long epicsShareAPI dbstat(void) /* for each entrypoint detected, print out entrypoint statistics */ pqe = (struct EP_LIST *) ellFirst(&pnode->ep_queue); while (pqe != NULL) { - double diff = tsStampDiffInSeconds(&time,&pqe->time); + double diff = epicsTimeDiffInSeconds(&time,&pqe->time); if (diff) { printf(" Entrypoint: %-28.28s #C: %5.5lu C/S: %7.1f\n", pqe->entrypoint->name, pqe->count,diff); diff --git a/src/db/dbBkpt.h b/src/db/dbBkpt.h index 80c6d3b6d..2d0b71c1f 100644 --- a/src/db/dbBkpt.h +++ b/src/db/dbBkpt.h @@ -35,7 +35,7 @@ #include "ellLib.h" #include "epicsEvent.h" #include "epicsThread.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "shareLib.h" #ifdef __cplusplus extern "C" { @@ -61,7 +61,7 @@ struct EP_LIST { ELLNODE *prev_list; struct dbCommon *entrypoint; /* pointer to entry point in lockset */ unsigned long count; /* number of times record processed */ - TS_STAMP time; /* time record first logged */ + epicsTimeStamp time; /* time record first logged */ char sched; /* schedule record for next dbContTask() pass */ }; diff --git a/src/db/dbCa.c b/src/db/dbCa.c index 400de59af..d5d235765 100644 --- a/src/db/dbCa.c +++ b/src/db/dbCa.c @@ -34,7 +34,7 @@ of this distribution. #include "epicsMutex.h" #include "epicsEvent.h" #include "epicsThread.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "errlog.h" #include "taskwd.h" #include "alarm.h" @@ -371,7 +371,7 @@ long epicsShareAPI dbCaGetSevr(struct link *plink,short *severity) return(0); } -long epicsShareAPI dbCaGetTimeStamp(struct link *plink,TS_STAMP *pstamp) +long epicsShareAPI dbCaGetTimeStamp(struct link *plink,epicsTimeStamp *pstamp) { caLink *pca; @@ -379,7 +379,7 @@ long epicsShareAPI dbCaGetTimeStamp(struct link *plink,TS_STAMP *pstamp) if(plink->type != CA_LINK) return(-1); pca = (caLink *)plink->value.pv_link.pvt; if(!pca->chid || ca_state(pca->chid)!=cs_conn) return(-1); - memcpy(pstamp,&pca->timeStamp,sizeof(TS_STAMP)); + memcpy(pstamp,&pca->timeStamp,sizeof(epicsTimeStamp)); return(0); } @@ -496,7 +496,7 @@ static void eventCallback(struct event_handler_args arg) } pdbr_time_double = (struct dbr_time_double *)arg.dbr; pca->sevr = (unsigned short)pdbr_time_double->severity; - memcpy(&pca->timeStamp,&pdbr_time_double->stamp,sizeof(TS_STAMP)); + memcpy(&pca->timeStamp,&pdbr_time_double->stamp,sizeof(epicsTimeStamp)); if(precord) { struct pv_link *ppv_link = &(plink->value.pv_link); diff --git a/src/db/dbCa.h b/src/db/dbCa.h index 189339dd2..bdd55a582 100644 --- a/src/db/dbCa.h +++ b/src/db/dbCa.h @@ -40,7 +40,7 @@ epicsShareFunc long epicsShareAPI dbCaGetNelements( epicsShareFunc long epicsShareAPI dbCaGetSevr( struct link *plink,short *severity); epicsShareFunc long epicsShareAPI dbCaGetTimeStamp( - struct link *plink,TS_STAMP *pstamp); + struct link *plink,epicsTimeStamp *pstamp); epicsShareFunc int epicsShareAPI dbCaIsLinkConnected(struct link *plink); epicsShareFunc int epicsShareAPI dbCaGetLinkDBFtype(struct link *plink); diff --git a/src/db/dbCaPvt.h b/src/db/dbCaPvt.h index ce1cc1898..e7d8b34bc 100644 --- a/src/db/dbCaPvt.h +++ b/src/db/dbCaPvt.h @@ -60,7 +60,7 @@ typedef struct caLink short dbrType; short link_action; unsigned short sevr; - TS_STAMP timeStamp; + epicsTimeStamp timeStamp; char gotInNative; char gotOutNative; char gotInString; diff --git a/src/db/dbCommon.dbd b/src/db/dbCommon.dbd index 57e466f35..270deaac5 100644 --- a/src/db/dbCommon.dbd +++ b/src/db/dbCommon.dbd @@ -230,7 +230,7 @@ prompt("Time") special(SPC_NOMOD) interest(4) - extra("TS_STAMP time") + extra("epicsTimeStamp time") } field(FLNK,DBF_FWDLINK) { prompt("Forward Process Link") diff --git a/src/db/dbConvert.c b/src/db/dbConvert.c index 6ac2ef30e..181387568 100644 --- a/src/db/dbConvert.c +++ b/src/db/dbConvert.c @@ -20,7 +20,6 @@ of this distribution. #include "dbDefs.h" #include "errlog.h" #include "cvtFast.h" -#include "tsStamp.h" #include "dbBase.h" #include "link.h" #include "dbFldTypes.h" diff --git a/src/db/dbEvent.c b/src/db/dbEvent.c index 59fa5f230..0a3b6bcab 100644 --- a/src/db/dbEvent.c +++ b/src/db/dbEvent.c @@ -36,7 +36,6 @@ of this distribution. #include "dbBase.h" #include "dbFldTypes.h" #include "link.h" -#include "tsStamp.h" #include "dbCommon.h" #include "caeventmask.h" #include "db_field_log.h" diff --git a/src/db/dbFastLinkConv.c b/src/db/dbFastLinkConv.c index 899690358..399d1a7d2 100644 --- a/src/db/dbFastLinkConv.c +++ b/src/db/dbFastLinkConv.c @@ -36,7 +36,6 @@ #include "dbDefs.h" #include "errlog.h" #include "cvtFast.h" -#include "tsStamp.h" #include "alarm.h" #include "dbBase.h" #include "link.h" diff --git a/src/db/dbLock.c b/src/db/dbLock.c index 7ea5e2d7a..7c319dcb6 100644 --- a/src/db/dbLock.c +++ b/src/db/dbLock.c @@ -67,7 +67,6 @@ since this will delay all other threads. #include "dbDefs.h" #include "dbBase.h" #include "epicsMutex.h" -#include "tsStamp.h" #include "epicsThread.h" #include "cantProceed.h" #include "ellLib.h" diff --git a/src/db/dbNotify.c b/src/db/dbNotify.c index b9fe22909..79db97f5b 100644 --- a/src/db/dbNotify.c +++ b/src/db/dbNotify.c @@ -42,7 +42,6 @@ #include "errlog.h" #include "errMdef.h" #include "ellLib.h" -#include "tsStamp.h" #include "dbBase.h" #include "dbStaticLib.h" #include "dbFldTypes.h" diff --git a/src/db/dbPutNotifyBlocker.cpp b/src/db/dbPutNotifyBlocker.cpp index 42f50189b..93246710e 100644 --- a/src/db/dbPutNotifyBlocker.cpp +++ b/src/db/dbPutNotifyBlocker.cpp @@ -20,7 +20,7 @@ #include "string.h" #include "epicsMutex.h" -#include "osiTime.h" +#include "epicsTime.h" #include "tsFreeList.h" #include "errMdef.h" @@ -72,11 +72,11 @@ int dbPutNotifyBlocker::initiatePutNotify ( cacNotify ¬ify, // wait for current put notify to complete this->lock (); if ( this->pPN ) { - osiTime begin = osiTime::getCurrent (); + epicsTime begin = epicsTime::getCurrent (); do { this->unlock (); this->block.wait ( 1.0 ); - if ( osiTime::getCurrent () - begin > 30.0 ) { + if ( epicsTime::getCurrent () - begin > 30.0 ) { pIO->destroy (); return ECA_PUTCBINPROG; } diff --git a/src/db/dbScan.c b/src/db/dbScan.c index 7c53a1dca..1493f9a14 100644 --- a/src/db/dbScan.c +++ b/src/db/dbScan.c @@ -56,7 +56,7 @@ #include "epicsEvent.h" #include "epicsInterrupt.h" #include "epicsThread.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "cantProceed.h" #include "epicsRingPointer.h" #include "epicsPrint.h" @@ -495,19 +495,19 @@ static void periodicTask(void *arg) { scan_list *psl = (scan_list *)arg; - TS_STAMP start_time,end_time; + epicsTimeStamp start_time,end_time; double diff; double delay; - tsStampGetCurrent(&start_time); + epicsTimeGetCurrent(&start_time); while(TRUE) { if(interruptAccept)scanList(psl); - tsStampGetCurrent(&end_time); - diff = tsStampDiffInSeconds(&end_time,&start_time); + epicsTimeGetCurrent(&end_time); + diff = epicsTimeDiffInSeconds(&end_time,&start_time); delay = psl->rate - diff; delay = (delay<=0.0) ? .1 : delay; epicsThreadSleep(delay); - tsStampGetCurrent(&start_time); + epicsTimeGetCurrent(&start_time); } } diff --git a/src/db/dbTest.c b/src/db/dbTest.c index eea280888..b7e297988 100644 --- a/src/db/dbTest.c +++ b/src/db/dbTest.c @@ -22,7 +22,6 @@ of this distribution. #include "errlog.h" #include "ellLib.h" #include "epicsMutex.h" -#include "tsStamp.h" #include "ellLib.h" #include "dbBase.h" #include "dbStaticLib.h" diff --git a/src/db/db_access.c b/src/db/db_access.c index 69fa9292d..5a380dd92 100644 --- a/src/db/db_access.c +++ b/src/db/db_access.c @@ -53,7 +53,7 @@ #include "dbDefs.h" #include "errlog.h" #include "ellLib.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "dbStaticLib.h" #include "dbBase.h" #include "dbCommon.h" @@ -213,7 +213,7 @@ struct dbr_sts_double{ struct dbr_time_string{ short status; /* status of value */ short severity; /* severity of alarm */ - TS_STAMP stamp; /* time stamp */ + epicsTimeStamp stamp; /* time stamp */ char value[MAX_STRING_SIZE]; /* current value */ }; @@ -221,7 +221,7 @@ struct dbr_time_string{ struct dbr_time_short{ short status; /* status of value */ short severity; /* severity of alarm */ - TS_STAMP stamp; /* time stamp */ + epicsTimeStamp stamp; /* time stamp */ short RISC_pad; /* RISC alignment */ short value; /* current value */ }; @@ -230,7 +230,7 @@ struct dbr_time_short{ struct dbr_time_float{ short status; /* status of value */ short severity; /* severity of alarm */ - TS_STAMP stamp; /* time stamp */ + epicsTimeStamp stamp; /* time stamp */ float value; /* current value */ }; @@ -238,7 +238,7 @@ struct dbr_time_float{ struct dbr_time_enum{ short status; /* status of value */ short severity; /* severity of alarm */ - TS_STAMP stamp; /* time stamp */ + epicsTimeStamp stamp; /* time stamp */ short RISC_pad; /* RISC alignment */ short value; /* current value */ }; @@ -247,7 +247,7 @@ struct dbr_time_enum{ struct dbr_time_char{ short status; /* status of value */ short severity; /* severity of alarm */ - TS_STAMP stamp; /* time stamp */ + epicsTimeStamp stamp; /* time stamp */ short RISC_pad0; /* RISC alignment */ char RISC_pad1; /* RISC alignment */ unsigned char value; /* current value */ @@ -257,7 +257,7 @@ struct dbr_time_char{ struct dbr_time_long{ short status; /* status of value */ short severity; /* severity of alarm */ - TS_STAMP stamp; /* time stamp */ + epicsTimeStamp stamp; /* time stamp */ long value; /* current value */ }; @@ -265,7 +265,7 @@ struct dbr_time_long{ struct dbr_time_double{ short status; /* status of value */ short severity; /* severity of alarm */ - TS_STAMP stamp; /* time stamp */ + epicsTimeStamp stamp; /* time stamp */ long RISC_pad; /* RISC alignment */ double value; /* current value */ }; diff --git a/src/db/db_field_log.h b/src/db/db_field_log.h index 150493180..44ce7403d 100644 --- a/src/db/db_field_log.h +++ b/src/db/db_field_log.h @@ -60,7 +60,7 @@ union native_value{ typedef struct db_field_log { unsigned short stat; /* Alarm Status */ unsigned short sevr; /* Alarm Severity */ - TS_STAMP time; /* time stamp */ + epicsTimeStamp time; /* time stamp */ union native_value field; /* field value */ }db_field_log; diff --git a/src/db/recGbl.c b/src/db/recGbl.c index b08f70d86..19f40617b 100644 --- a/src/db/recGbl.c +++ b/src/db/recGbl.c @@ -48,7 +48,7 @@ #include #include "dbDefs.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "epicsPrint.h" #include "dbBase.h" #include "dbFldTypes.h" @@ -331,10 +331,10 @@ void epicsShareAPI recGblGetTimeStamp(void* prec) if(pr->tsel.type!=CONSTANT) { dbGetLink(&(pr->tsel), DBR_SHORT,&(pr->tse),0,0); - status = tsStampGetEvent(&pr->time,(unsigned)pr->tse); + status = epicsTimeGetEvent(&pr->time,(unsigned)pr->tse); } else - status = tsStampGetEvent(&pr->time,(unsigned)pr->tse); + status = epicsTimeGetEvent(&pr->time,(unsigned)pr->tse); if(status) errlogPrintf("%s recGblGetTimeStamp failed\n",pr->name); } diff --git a/src/db/test/callbackTest.c b/src/db/test/callbackTest.c index 897ba718b..37b900a15 100644 --- a/src/db/test/callbackTest.c +++ b/src/db/test/callbackTest.c @@ -18,23 +18,23 @@ of this distribution. #include "errlog.h" #include "callback.h" #include "taskwd.h" -#include "tsStamp.h" +#include "epicsTime.h" typedef struct myPvt { CALLBACK callback; double requestedDiff; - TS_STAMP start; + epicsTimeStamp start; }myPvt; static void myCallback(CALLBACK *pCallback) { myPvt *pmyPvt; - TS_STAMP end; + epicsTimeStamp end; double diff; callbackGetUser(pmyPvt,pCallback); - tsStampGetCurrent(&end); - diff = tsStampDiffInSeconds(&end,&pmyPvt->start); + epicsTimeGetCurrent(&end); + diff = epicsTimeDiffInSeconds(&end,&pmyPvt->start); printf("myCallback requestedDiff %f diff %f\n",pmyPvt->requestedDiff,diff); } @@ -44,7 +44,7 @@ void callbackTest(void) { myPvt *nowait[ncallbacks]; myPvt *wait[ncallbacks]; - TS_STAMP start; + epicsTimeStamp start; int i; taskwdInit(); @@ -55,7 +55,7 @@ void callbackTest(void) callbackSetCallback(myCallback,&nowait[i]->callback); callbackSetUser(nowait[i],&nowait[i]->callback); callbackSetPriority(i%3,&nowait[i]->callback); - tsStampGetCurrent(&start); + epicsTimeGetCurrent(&start); nowait[i]->start = start; nowait[i]->requestedDiff = 0.0; callbackRequest(&nowait[i]->callback); @@ -63,7 +63,7 @@ void callbackTest(void) callbackSetCallback(myCallback,&wait[i]->callback); callbackSetUser(wait[i],&wait[i]->callback); callbackSetPriority(i%3,&wait[i]->callback); - tsStampGetCurrent(&start); + epicsTimeGetCurrent(&start); wait[i]->start = start; wait[i]->requestedDiff = (double)i; callbackRequestDelayed(&wait[i]->callback,wait[i]->requestedDiff); diff --git a/src/dbStatic/dbToRecordtypeH.c b/src/dbStatic/dbToRecordtypeH.c index 246a5c58b..74b28048b 100644 --- a/src/dbStatic/dbToRecordtypeH.c +++ b/src/dbStatic/dbToRecordtypeH.c @@ -125,7 +125,7 @@ int main(int argc,char **argv) fprintf(outFile,"#include \"ellLib.h\"\n"); fprintf(outFile,"#include \"epicsMutex.h\"\n"); fprintf(outFile,"#include \"link.h\"\n"); - fprintf(outFile,"#include \"tsStamp.h\"\n"); + fprintf(outFile,"#include \"epicsTime.h\"\n"); pdbMenu = (dbMenu *)ellFirst(&pdbbase->menuList); while(pdbMenu) { fprintf(outFile,"\n#ifndef INC%sH\n",pdbMenu->name); diff --git a/src/gdd/aitHelpers.cc b/src/gdd/aitHelpers.cc index d43aaad7f..65695c502 100644 --- a/src/gdd/aitHelpers.cc +++ b/src/gdd/aitHelpers.cc @@ -5,11 +5,14 @@ // $Id$ // // $Log$ +// Revision 1.12 1999/08/05 22:15:42 jhill +// removed knowledge of class osiTime +// // Revision 1.11 1999/05/10 23:38:33 jhill // convert to and from other time stamp formats // // Revision 1.10 1999/05/03 16:20:51 jhill -// allow aitTimeStamp to convert to TS_STAMP (without binding to libCom) +// allow aitTimeStamp to convert to epicsTimeStamp (without binding to libCom) // // Revision 1.9 1998/05/05 21:08:26 jhill // fixed warning @@ -189,14 +192,14 @@ int aitString::init(const char* p, aitStrType typeIn, unsigned strLengthIn, unsi // to link with libCom // -struct TS_STAMP { +struct epicsTimeStamp { aitUint32 secPastEpoch; /* seconds since 0000 Jan 1, 1990 */ aitUint32 nsec; /* nanoseconds within second */ }; -aitTimeStamp::operator struct TS_STAMP () const +aitTimeStamp::operator struct epicsTimeStamp () const { - TS_STAMP ts; + epicsTimeStamp ts; if (this->tv_sec>aitTimeStamp::epicsEpochSecPast1970) { ts.secPastEpoch = this->tv_sec - aitTimeStamp::epicsEpochSecPast1970; @@ -209,7 +212,7 @@ aitTimeStamp::operator struct TS_STAMP () const return ts; } -void aitTimeStamp::get (struct TS_STAMP &ts) const +void aitTimeStamp::get (struct epicsTimeStamp &ts) const { if (this->tv_sec>aitTimeStamp::epicsEpochSecPast1970) { ts.secPastEpoch = this->tv_sec - aitTimeStamp::epicsEpochSecPast1970; @@ -221,13 +224,13 @@ void aitTimeStamp::get (struct TS_STAMP &ts) const } } -aitTimeStamp::aitTimeStamp (const struct TS_STAMP &ts) +aitTimeStamp::aitTimeStamp (const struct epicsTimeStamp &ts) { this->tv_sec = ts.secPastEpoch + aitTimeStamp::epicsEpochSecPast1970; this->tv_nsec = ts.nsec; } -aitTimeStamp aitTimeStamp::operator = (const struct TS_STAMP &rhs) +aitTimeStamp aitTimeStamp::operator = (const struct epicsTimeStamp &rhs) { this->tv_sec = rhs.secPastEpoch + aitTimeStamp::epicsEpochSecPast1970; this->tv_nsec = rhs.nsec; diff --git a/src/gdd/aitHelpers.h b/src/gdd/aitHelpers.h index 1a7a3a1f3..7329d932f 100644 --- a/src/gdd/aitHelpers.h +++ b/src/gdd/aitHelpers.h @@ -8,6 +8,9 @@ * $Id$ * * $Log$ + * Revision 1.21 1999/10/28 18:12:54 jhill + * removed use of macro max() because it was classing with the C++ RTL + * * Revision 1.20 1999/08/05 22:17:11 jhill * removed knowledge of class osiTime * @@ -15,7 +18,7 @@ * convert to and from other time stamp formats * * Revision 1.18 1999/05/03 16:20:51 jhill - * allow aitTimeStamp to convert to TS_STAMP (without binding to libCom) + * allow aitTimeStamp to convert to epicsTimeStamp (without binding to libCom) * * Revision 1.17 1999/04/30 00:09:47 jhill * proper borrow @@ -96,7 +99,7 @@ inline char* strDup(const char* x) struct timespec; -struct TS_STAMP; +struct epicsTimeStamp; class gdd; class epicsShareClass aitTimeStamp { @@ -156,12 +159,12 @@ public: aitTimeStamp operator = (const struct timespec &rhs); // - // convert to and from EPICS TS_STAMP format + // convert to and from EPICS epicsTimeStamp format // - operator struct TS_STAMP () const; - void get (struct TS_STAMP &) const; - aitTimeStamp (const struct TS_STAMP &ts); - aitTimeStamp operator = (const struct TS_STAMP &rhs); + operator struct epicsTimeStamp () const; + void get (struct epicsTimeStamp &) const; + aitTimeStamp (const struct epicsTimeStamp &ts); + aitTimeStamp operator = (const struct epicsTimeStamp &rhs); static aitTimeStamp getCurrent(); diff --git a/src/gdd/gdd.h b/src/gdd/gdd.h index 0e72e8522..2860d3677 100644 --- a/src/gdd/gdd.h +++ b/src/gdd/gdd.h @@ -8,6 +8,9 @@ * $Id$ * * $Log$ + * Revision 1.33 2000/10/13 01:17:51 jhill + * made gdd param to copy const + * * Revision 1.32 2000/06/12 17:32:11 jhill * moved stdlib.h (an ANSI C file) outside of OS depen switch * @@ -153,7 +156,7 @@ class gddContainer; class gddArray; class gddScalar; -struct TS_STAMP; +struct epicsTimeStamp; struct timespec; // Not Complete in this prototype: @@ -255,11 +258,11 @@ public: void getTimeStamp(struct timespec* const ts) const; void getTimeStamp(aitTimeStamp* const ts) const; - void getTimeStamp(struct TS_STAMP* const ts) const; + void getTimeStamp(struct epicsTimeStamp* const ts) const; void setTimeStamp(const struct timespec* const ts); void setTimeStamp(const aitTimeStamp* const ts); - void setTimeStamp(const struct TS_STAMP* const ts); + void setTimeStamp(const struct epicsTimeStamp* const ts); void setStatus(aitUint32); void setStatus(aitUint16 high, aitUint16 low); diff --git a/src/gdd/gddI.h b/src/gdd/gddI.h index cc9222746..119a4cb62 100644 --- a/src/gdd/gddI.h +++ b/src/gdd/gddI.h @@ -8,6 +8,9 @@ * $Id$ * * $Log$ + * Revision 1.9 2000/10/13 01:17:52 jhill + * made gdd param to copy const + * * Revision 1.8 1999/08/10 19:57:15 jhill * moved inlines in order to eliminate g++ warnings * @@ -108,8 +111,8 @@ inline void gdd::setTimeStamp(const struct timespec* const ts) { time_stamp=*ts; inline void gdd::getTimeStamp(aitTimeStamp* const ts) const { *ts = time_stamp; } inline void gdd::setTimeStamp(const aitTimeStamp* const ts) { time_stamp=*ts; } -inline void gdd::getTimeStamp(struct TS_STAMP* const ts) const { time_stamp.get(*ts); } -inline void gdd::setTimeStamp(const struct TS_STAMP* const ts) { time_stamp=*ts; } +inline void gdd::getTimeStamp(struct epicsTimeStamp* const ts) const { time_stamp.get(*ts); } +inline void gdd::setTimeStamp(const struct epicsTimeStamp* const ts) { time_stamp=*ts; } inline void gdd::setStatus(aitUint32 s) { status=s; } inline void gdd::getStatus(aitUint32& s) const { s=status; } diff --git a/src/iocsh/dbBkptRegister.c b/src/iocsh/dbBkptRegister.c index b7dfff2c5..197ffecd1 100644 --- a/src/iocsh/dbBkptRegister.c +++ b/src/iocsh/dbBkptRegister.c @@ -13,7 +13,6 @@ of this distribution. #include #include "ellLib.h" -#include "tsStamp.h" #include "errlog.h" #include "alarm.h" #include "dbBase.h" diff --git a/src/libCom/Makefile b/src/libCom/Makefile index 8c98fdecb..fc6a045a9 100644 --- a/src/libCom/Makefile +++ b/src/libCom/Makefile @@ -133,17 +133,16 @@ INC += osdPoolStatus.h INC += osdThread.h INC += epicsThread.h -INC += osiTime.h +INC += epicsTime.h INC += osdTime.h INC += osiSigPipeIgnore.h INC += osdSigPipeIgnore.h -INC += tsStamp.h INC += osiProcess.h INC += osiUnistd.h INC += osiWireFormat.h SRCS += epicsThread.cpp -SRCS += osiTime.cpp +SRCS += epicsTime.cpp SRCS += osdSock.c SRCS += osiSock.c @@ -159,7 +158,6 @@ SRCS += osdTime.cpp SRCS += osdSigPipeIgnore.c SRCS += osdProcess.c SRCS += osdNetIntf.c -#tsStamp code is part of osiTime and osdTime SRC_DIRS += $(LIBCOM)/taskwd INC += taskwd.h diff --git a/src/libCom/fdmgr/fdManager.cpp b/src/libCom/fdmgr/fdManager.cpp index 30346b605..b8db1b8b1 100644 --- a/src/libCom/fdmgr/fdManager.cpp +++ b/src/libCom/fdmgr/fdManager.cpp @@ -171,7 +171,7 @@ epicsShareFunc void fdManager::process (double delay) } tv.tv_sec = static_cast (minDelay); - tv.tv_usec = static_cast ((minDelay-tv.tv_sec)*osiTime::uSecPerSec); + tv.tv_usec = static_cast ((minDelay-tv.tv_sec)*epicsTime::uSecPerSec); /* * win32 requires this (others will diff --git a/src/libCom/fdmgr/fdManager.h b/src/libCom/fdmgr/fdManager.h index e66336d16..d22be0274 100644 --- a/src/libCom/fdmgr/fdManager.h +++ b/src/libCom/fdmgr/fdManager.h @@ -39,7 +39,7 @@ #include "shareLib.h" // reset share lib defines #include "tsDLList.h" #include "resourceLib.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "osiSock.h" #include "osiTimer.h" diff --git a/src/libCom/fdmgr/fdmgr.cpp b/src/libCom/fdmgr/fdmgr.cpp index bf46d7059..502a9dbb3 100644 --- a/src/libCom/fdmgr/fdmgr.cpp +++ b/src/libCom/fdmgr/fdmgr.cpp @@ -193,7 +193,7 @@ extern "C" epicsShareFunc fdctx * epicsShareAPI fdmgr_init (void) extern "C" epicsShareFunc fdmgrAlarmId epicsShareAPI fdmgr_add_timeout ( fdctx *pfdctx, struct timeval *ptimeout, pCallBackFDMgr pFunc, void *pParam) { - double delay = ptimeout->tv_sec + ptimeout->tv_usec / static_cast (osiTime::uSecPerSec); + double delay = ptimeout->tv_sec + ptimeout->tv_usec / static_cast (epicsTime::uSecPerSec); oldFdmgr *pfdm = static_cast (pfdctx); osiTimerForOldFdmgr *pTimer; unsigned id; @@ -339,7 +339,7 @@ extern "C" epicsShareFunc int epicsShareAPI fdmgr_clear_callback ( extern "C" epicsShareFunc int epicsShareAPI fdmgr_pend_event (fdctx *pfdctx, struct timeval *ptimeout) { oldFdmgr *pfdm = static_cast (pfdctx); - double delay = ptimeout->tv_sec + ptimeout->tv_usec / static_cast (osiTime::uSecPerSec); + double delay = ptimeout->tv_sec + ptimeout->tv_usec / static_cast (epicsTime::uSecPerSec); # ifdef noExceptionsFromCXX pfdm->process (delay); diff --git a/src/libCom/osi/epicsTime.h b/src/libCom/osi/epicsTime.h index 8d7569d32..19d2caae7 100644 --- a/src/libCom/osi/epicsTime.h +++ b/src/libCom/osi/epicsTime.h @@ -87,17 +87,17 @@ public: epicsTime (const time_t_wrapper &tv); epicsTime operator = (const time_t_wrapper &rhs); - // convert to and from ANSI C's "struct tm" (with nano seconds) + // convert to and from ANSI Cs "struct tm" (with nano seconds) operator tm_nano_sec () const; epicsTime (const tm_nano_sec &ts); epicsTime operator = (const tm_nano_sec &rhs); - // convert to and from POSIX RT's "struct timespec" + // convert to and from POSIX RTs "struct timespec" operator struct timespec () const; epicsTime (const struct timespec &ts); epicsTime operator = (const struct timespec &rhs); - // convert to and from BSD's "struct timeval" + // convert to and from BSDs "struct timeval" operator struct timeval () const; epicsTime (const struct timeval &ts); epicsTime operator = (const struct timeval &rhs); @@ -107,7 +107,7 @@ public: epicsTime (const ntpTimeStamp &ts); epicsTime operator = (const ntpTimeStamp &rhs); - // convert to and from GDD's aitTimeStamp format + // convert to and from GDDs aitTimeStamp format operator aitTimeStamp () const; epicsTime (const aitTimeStamp &ts); epicsTime operator = (const aitTimeStamp &rhs); diff --git a/src/libCom/osi/os/RTEMS/osdTime.cpp b/src/libCom/osi/os/RTEMS/osdTime.cpp index ffafd24c6..49dbec7ba 100644 --- a/src/libCom/osi/os/RTEMS/osdTime.cpp +++ b/src/libCom/osi/os/RTEMS/osdTime.cpp @@ -21,7 +21,7 @@ * EPICS */ #define epicsExportSharedSymbols -#include "osiTime.h" +#include "epicsTime.h" #include "errlog.h" extern "C" { @@ -45,7 +45,7 @@ static unsigned long timeoffset; * Allow for this to be called before clockInit() and before * system time and date have been initialized. */ -int tsStampGetCurrent (TS_STAMP *pDest) +int epicsTimeGetCurrent (epicsTimeStamp *pDest) { struct timeval curtime; rtems_interval t; @@ -56,27 +56,27 @@ int tsStampGetCurrent (TS_STAMP *pDest) if (sc == RTEMS_SUCCESSFUL) break; else if (sc != RTEMS_NOT_DEFINED) - return tsStampERROR; + return epicsTimeERROR; sc = rtems_clock_get (RTEMS_CLOCK_GET_TICKS_PER_SECOND, &t); if (sc != RTEMS_SUCCESSFUL) - return tsStampERROR; + return epicsTimeERROR; rtems_task_wake_after (t); } pDest->nsec = curtime.tv_usec * 1000; pDest->secPastEpoch = curtime.tv_sec - timeoffset; - return tsStampOK; + return epicsTimeOK; } /* - * tsStampGetEvent () + * epicsTimeGetEvent () */ -int tsStampGetEvent (TS_STAMP *pDest, unsigned eventNumber) +int epicsTimeGetEvent (epicsTimeStamp *pDest, unsigned eventNumber) { - if (eventNumber==tsStampEventCurrentTime) { - return tsStampGetCurrent (pDest); + if (eventNumber==epicsTimeEventCurrentTime) { + return epicsTimeGetCurrent (pDest); } else { - return tsStampERROR; + return epicsTimeERROR; } } diff --git a/src/libCom/osi/os/VMS/osdTime.cpp b/src/libCom/osi/os/VMS/osdTime.cpp index f2b937f51..86e6e4dfc 100644 --- a/src/libCom/osi/os/VMS/osdTime.cpp +++ b/src/libCom/osi/os/VMS/osdTime.cpp @@ -6,12 +6,12 @@ #include "osiSock.h" #define epicsExportSharedSymbols -#include "osiTime.h" +#include "epicsTime.h" // -// osiTime::osdGetCurrent () +// epicsTime::osdGetCurrent () // -extern "C" epicsShareFunc int tsStampGetCurrent (TS_STAMP *pDest) +extern "C" epicsShareFunc int epicsTimeGetCurrent (epicsTimeStamp *pDest) { # if defined(CLOCK_REALTIME) struct timespec ts; @@ -21,7 +21,7 @@ extern "C" epicsShareFunc int tsStampGetCurrent (TS_STAMP *pDest) if (status) { return -1; } - *pDest = osiTime (ts); + *pDest = epicsTime (ts); return 0; # else int status; @@ -31,20 +31,20 @@ extern "C" epicsShareFunc int tsStampGetCurrent (TS_STAMP *pDest) if (status!=0) { return -1; } - *pDest = osiTime (tv); + *pDest = epicsTime (tv); return 0; # endif } // -// tsStampGetEvent () +// epicsTimeGetEvent () // -extern "C" epicsShareFunc int epicsShareAPI tsStampGetEvent (TS_STAMP *pDest, unsigned eventNumber) +extern "C" epicsShareFunc int epicsShareAPI epicsTimeGetEvent (epicsTimeStamp *pDest, unsigned eventNumber) { - if (eventNumber==tsStampEventCurrentTime) { - return tsStampGetCurrent (pDest); + if (eventNumber==epicsTimeEventCurrentTime) { + return epicsTimeGetCurrent (pDest); } else { - return tsStampERROR; + return epicsTimeERROR; } } \ No newline at end of file diff --git a/src/libCom/osi/os/WIN32/osdTime.cpp b/src/libCom/osi/os/WIN32/osdTime.cpp index 4df5254bc..edfeb3ed6 100644 --- a/src/libCom/osi/os/WIN32/osdTime.cpp +++ b/src/libCom/osi/os/WIN32/osdTime.cpp @@ -31,7 +31,7 @@ // EPICS // #define epicsExportSharedSymbols -#include "osiTime.h" +#include "epicsTime.h" #include "errlog.h" #include "epicsAssert.h" @@ -83,13 +83,13 @@ static void osdTimeExit () */ static unsigned __stdcall osdTimeSynchThreadEntry (LPVOID) { - static const DWORD tmoTenSec = 10 * osiTime::mSecPerSec; + static const DWORD tmoTenSec = 10 * epicsTime::mSecPerSec; int status; while ( ! osdTimeSyncThreadExit ) { Sleep (tmoTenSec); status = osdTimeSych (); - if (status!=tsStampOK) { + if (status!=epicsTimeOK) { errlogPrintf ("osdTimeSych (): failed?\n"); } } @@ -171,7 +171,7 @@ static void osdTimeInit () ReleaseMutex ( osdTimeMutex ); unixStyleStatus = osdTimeSych (); - if ( unixStyleStatus != tsStampOK ) { + if ( unixStyleStatus != epicsTimeOK ) { CloseHandle ( osdTimeMutex ); osdTimeMutex = NULL; return; @@ -197,7 +197,7 @@ static void osdTimeInit () // static int osdTimeSych () { - static const DWORD tmoTwentySec = 20 * osiTime::mSecPerSec; + static const DWORD tmoTwentySec = 20 * epicsTime::mSecPerSec; LONGLONG new_sec_offset, new_frac_offset; LARGE_INTEGER parm; LONGLONG secondsSinceBoot; @@ -209,13 +209,13 @@ static int osdTimeSych () if (!osdTimeMutex) { osdTimeInit (); if (!osdTimeMutex) { - return tsStampERROR; + return epicsTimeERROR; } } win32SemStat = WaitForSingleObject (osdTimeMutex, tmoTwentySec); if ( win32SemStat != WAIT_OBJECT_0 ) { - return tsStampERROR; + return epicsTimeERROR; } // @@ -228,7 +228,7 @@ static int osdTimeSych () // has forced its code to load if (QueryPerformanceCounter (&parm)==0) { ReleaseMutex (osdTimeMutex); - return tsStampERROR; + return epicsTimeERROR; } perf_last = parm.QuadPart; @@ -313,18 +313,18 @@ static int osdTimeSych () win32Stat = ReleaseMutex (osdTimeMutex); if (!win32Stat) { - return tsStampERROR; + return epicsTimeERROR; } - return tsStampOK; + return epicsTimeOK; } // -// osiTime::osdGetCurrent () +// epicsTime::osdGetCurrent () // -extern "C" epicsShareFunc int epicsShareAPI tsStampGetCurrent (TS_STAMP *pDest) +extern "C" epicsShareFunc int epicsShareAPI epicsTimeGetCurrent (epicsTimeStamp *pDest) { - static const DWORD tmoTwentySec = 20 * osiTime::mSecPerSec; + static const DWORD tmoTwentySec = 20 * epicsTime::mSecPerSec; LONGLONG time_cur, time_sec, time_remainder; LARGE_INTEGER parm; BOOL status; @@ -335,13 +335,13 @@ extern "C" epicsShareFunc int epicsShareAPI tsStampGetCurrent (TS_STAMP *pDest) if (!osdTimeMutex) { osdTimeInit (); if (!osdTimeMutex) { - return tsStampERROR; + return epicsTimeERROR; } } status = WaitForSingleObject (osdTimeMutex, tmoTwentySec); if ( status != WAIT_OBJECT_0 ) { - return tsStampERROR; + return epicsTimeERROR; } // @@ -352,7 +352,7 @@ extern "C" epicsShareFunc int epicsShareAPI tsStampGetCurrent (TS_STAMP *pDest) status = QueryPerformanceCounter (&parm); if (!status) { ReleaseMutex (osdTimeMutex); - return tsStampERROR; + return epicsTimeERROR; } time_cur = parm.QuadPart; if (perf_last > time_cur) { @@ -389,26 +389,26 @@ extern "C" epicsShareFunc int epicsShareAPI tsStampGetCurrent (TS_STAMP *pDest) perf_last = time_cur; pDest->secPastEpoch = (unsigned long) (time_sec%ULONG_MAX); - pDest->nsec = (unsigned long) ((time_remainder*osiTime::nSecPerSec)/perf_freq); + pDest->nsec = (unsigned long) ((time_remainder*epicsTime::nSecPerSec)/perf_freq); status = ReleaseMutex (osdTimeMutex); if (!status) { - return tsStampERROR; + return epicsTimeERROR; } - return tsStampOK; + return epicsTimeOK; } // -// tsStampGetEvent () +// epicsTimeGetEvent () // -extern "C" epicsShareFunc int epicsShareAPI tsStampGetEvent (TS_STAMP *pDest, unsigned eventNumber) +extern "C" epicsShareFunc int epicsShareAPI epicsTimeGetEvent (epicsTimeStamp *pDest, unsigned eventNumber) { - if (eventNumber==tsStampEventCurrentTime) { - return tsStampGetCurrent (pDest); + if (eventNumber==epicsTimeEventCurrentTime) { + return epicsTimeGetCurrent (pDest); } else { - return tsStampERROR; + return epicsTimeERROR; } } diff --git a/src/libCom/osi/os/posix/osdEvent.c b/src/libCom/osi/os/posix/osdEvent.c index abb4420c8..4ce03831a 100644 --- a/src/libCom/osi/os/posix/osdEvent.c +++ b/src/libCom/osi/os/posix/osdEvent.c @@ -19,7 +19,7 @@ of this distribution. #include "epicsEvent.h" #include "cantProceed.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "errlog.h" #include "epicsAssert.h" @@ -46,12 +46,12 @@ if(status) { \ static void convertDoubleToWakeTime(double timeout,struct timespec *wakeTime) { struct timespec wait; - TS_STAMP stamp; + epicsTimeStamp stamp; if(timeout<0.0) timeout = 0.0; else if(timeout>3600.0) timeout = 3600.0; - tsStampGetCurrent(&stamp); - tsStampToTimespec(wakeTime, &stamp); + epicsTimeGetCurrent(&stamp); + epicsTimeToTimespec(wakeTime, &stamp); wait.tv_sec = timeout; wait.tv_nsec = (long)((timeout - (double)wait.tv_sec) * 1e9); wakeTime->tv_sec += wait.tv_sec; diff --git a/src/libCom/osi/os/posix/osdMutex.c b/src/libCom/osi/os/posix/osdMutex.c index 7e15a9761..c5db878a4 100644 --- a/src/libCom/osi/os/posix/osdMutex.c +++ b/src/libCom/osi/os/posix/osdMutex.c @@ -19,7 +19,7 @@ of this distribution. #include "epicsMutex.h" #include "cantProceed.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "errlog.h" #include "epicsAssert.h" @@ -52,12 +52,12 @@ if(status) { \ static void convertDoubleToWakeTime(double timeout,struct timespec *wakeTime) { struct timespec wait; - TS_STAMP stamp; + epicsTimeStamp stamp; if(timeout<0.0) timeout = 0.0; else if(timeout>3600.0) timeout = 3600.0; - tsStampGetCurrent(&stamp); - tsStampToTimespec(wakeTime, &stamp); + epicsTimeGetCurrent(&stamp); + epicsTimeToTimespec(wakeTime, &stamp); wait.tv_sec = timeout; wait.tv_nsec = (long)((timeout - (double)wait.tv_sec) * 1e9); wakeTime->tv_sec += wait.tv_sec; diff --git a/src/libCom/osi/os/posix/osdTime.cpp b/src/libCom/osi/os/posix/osdTime.cpp index 7284b9c4c..71bf044e5 100644 --- a/src/libCom/osi/os/posix/osdTime.cpp +++ b/src/libCom/osi/os/posix/osdTime.cpp @@ -6,13 +6,13 @@ #include "osiSock.h" #define epicsExportSharedSymbols -#include "osiTime.h" +#include "epicsTime.h" // -// osiTime::osdGetCurrent () +// epicsTime::osdGetCurrent () // -extern "C" epicsShareFunc int epicsShareAPI tsStampGetCurrent (TS_STAMP *pDest) +extern "C" epicsShareFunc int epicsShareAPI epicsTimeGetCurrent (epicsTimeStamp *pDest) { # ifdef _POSIX_TIMERS struct timespec ts; @@ -20,33 +20,33 @@ extern "C" epicsShareFunc int epicsShareAPI tsStampGetCurrent (TS_STAMP *pDest) status = clock_gettime (CLOCK_REALTIME, &ts); if (status) { - return tsStampERROR; + return epicsTimeERROR; } - *pDest = osiTime (ts); - return tsStampOK; + *pDest = epicsTime (ts); + return epicsTimeOK; # else int status; struct timeval tv; status = gettimeofday (&tv, NULL); if (status) { - return tsStampERROR; + return epicsTimeERROR; } - *pDest = osiTime (tv); - return tsStampOK; + *pDest = epicsTime (tv); + return epicsTimeOK; # endif } // -// tsStampGetEvent () +// epicsTimeGetEvent () // -extern "C" epicsShareFunc int epicsShareAPI tsStampGetEvent (TS_STAMP *pDest, unsigned eventNumber) +extern "C" epicsShareFunc int epicsShareAPI epicsTimeGetEvent (epicsTimeStamp *pDest, unsigned eventNumber) { - if (eventNumber==tsStampEventCurrentTime) { - return tsStampGetCurrent (pDest); + if (eventNumber==epicsTimeEventCurrentTime) { + return epicsTimeGetCurrent (pDest); } else { - return tsStampERROR; + return epicsTimeERROR; } } diff --git a/src/libCom/osi/os/vxWorks/iocClock.c b/src/libCom/osi/os/vxWorks/iocClock.c index ad94f66db..8a0487bd9 100644 --- a/src/libCom/osi/os/vxWorks/iocClock.c +++ b/src/libCom/osi/os/vxWorks/iocClock.c @@ -26,24 +26,24 @@ of this distribution. #include "errlog.h" #include "epicsThread.h" #include "epicsMutex.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "iocClock.h" #define BILLION 1000000000 #define iocClockSyncRate 10.0 -static int iocClockGetCurrent(TS_STAMP *pDest); -static int iocClockGetEvent(TS_STAMP *pDest, unsigned eventNumber); +static int iocClockGetCurrent(epicsTimeStamp *pDest); +static int iocClockGetEvent(epicsTimeStamp *pDest, unsigned eventNumber); typedef struct iocClockPvt { epicsMutexId lock; - TS_STAMP clock; + epicsTimeStamp clock; unsigned long lastTick; epicsUInt32 nanosecondsPerTick; int tickRate; int ticksToSkip; - ptsStampGetCurrent getCurrent; - ptsStampGetEvent getEvent; + pepicsTimeGetCurrent getCurrent; + pepicsTimeGetEvent getEvent; char *pserverAddr; }iocClockPvt; static iocClockPvt *piocClockPvt = 0; @@ -53,7 +53,7 @@ extern char* sysBootLine; static void syncNTP(void) { struct timespec Currtime; - TS_STAMP epicsTime; + epicsTimeStamp epicsTime; STATUS status; int prevStatusBad = 0; int firstTime=1; @@ -75,9 +75,9 @@ static void syncNTP(void) errlogPrintf("iocClockSyncWithNTPserver: sntpcTimeGet OK\n"); prevStatusBad = 0; } - tsStampFromTimespec(&epicsTime,&Currtime); + epicsTimeFromTimespec(&epicsTime,&Currtime); epicsMutexMustLock(piocClockPvt->lock); - diffTime = tsStampDiffInSeconds(&epicsTime,&piocClockPvt->clock); + diffTime = epicsTimeDiffInSeconds(&epicsTime,&piocClockPvt->clock); if(diffTime>=0.0) { piocClockPvt->clock = epicsTime; } else {/*dont go back in time*/ @@ -118,8 +118,8 @@ void iocClockInit() return; } -void iocClockRegister(ptsStampGetCurrent getCurrent, - ptsStampGetEvent getEvent) +void iocClockRegister(pepicsTimeGetCurrent getCurrent, + pepicsTimeGetEvent getEvent) { if(piocClockPvt) { printf("iocClockRegister: iocClock already initialized\n"); @@ -130,7 +130,7 @@ void iocClockRegister(ptsStampGetCurrent getCurrent, piocClockPvt->getEvent = getEvent; } -int iocClockGetCurrent(TS_STAMP *pDest) +int iocClockGetCurrent(epicsTimeStamp *pDest) { unsigned long currentTick,nticks,nsecs; @@ -162,26 +162,26 @@ int iocClockGetCurrent(TS_STAMP *pDest) return(0); } -int iocClockGetEvent(TS_STAMP *pDest, unsigned eventNumber) +int iocClockGetEvent(epicsTimeStamp *pDest, unsigned eventNumber) { - if (eventNumber==tsStampEventCurrentTime) { + if (eventNumber==epicsTimeEventCurrentTime) { *pDest = piocClockPvt->clock; return(0); } - return(tsStampERROR); + return(epicsTimeERROR); } -int tsStampGetCurrent (TS_STAMP *pDest) +int epicsTimeGetCurrent (epicsTimeStamp *pDest) { if(piocClockPvt->getCurrent) return((*piocClockPvt->getCurrent)(pDest)); - return(tsStampERROR); + return(epicsTimeERROR); } -int tsStampGetEvent (TS_STAMP *pDest, unsigned eventNumber) +int epicsTimeGetEvent (epicsTimeStamp *pDest, unsigned eventNumber) { if(piocClockPvt->getEvent) return((*piocClockPvt->getEvent)(pDest,eventNumber)); - return(tsStampERROR); + return(epicsTimeERROR); } /* Unless @@ -191,17 +191,17 @@ int tsStampGetEvent (TS_STAMP *pDest, unsigned eventNumber) */ void date() { - TS_STAMP now; + epicsTimeStamp now; char nowText[40]; size_t rtn; - rtn = tsStampGetCurrent(&now); + rtn = epicsTimeGetCurrent(&now); if(rtn) { - printf("tsStampGetCurrent failed\n"); + printf("epicsTimeGetCurrent failed\n"); return; } nowText[0] = 0; - rtn = tsStampToStrftime(nowText,sizeof(nowText), + rtn = epicsTimeToStrftime(nowText,sizeof(nowText), "%Y/%m/%d %H:%M:%S.%06f",&now); printf("%s\n",nowText); } diff --git a/src/libCom/osi/os/vxWorks/iocClock.h b/src/libCom/osi/os/vxWorks/iocClock.h index a470c8481..aeecb5f76 100644 --- a/src/libCom/osi/os/vxWorks/iocClock.h +++ b/src/libCom/osi/os/vxWorks/iocClock.h @@ -8,10 +8,10 @@ described on the COPYRIGHT_UniversityOfChicago file included as part of this distribution. ****************************************************************************/ -#include "tsStamp.h" +#include "epicsTime.h" -typedef int (*ptsStampGetCurrent)(TS_STAMP *pDest); -typedef int (*ptsStampGetEvent)(TS_STAMP *pDest,unsigned eventNumber); +typedef int (*pepicsTimeGetCurrent)(epicsTimeStamp *pDest); +typedef int (*pepicsTimeGetEvent)(epicsTimeStamp *pDest,unsigned eventNumber); void iocClockInit(void); -void iocClockRegister(ptsStampGetCurrent getCurrent,ptsStampGetEvent getEvent); +void iocClockRegister(pepicsTimeGetCurrent getCurrent,pepicsTimeGetEvent getEvent); diff --git a/src/libCom/osi/os/vxWorks/osdTime.cpp b/src/libCom/osi/os/vxWorks/osdTime.cpp index 636d33b1a..d7142df58 100644 --- a/src/libCom/osi/os/vxWorks/osdTime.cpp +++ b/src/libCom/osi/os/vxWorks/osdTime.cpp @@ -1,2 +1,2 @@ // this is not needed -// tsStampGetCurrent and tsStampGetEvent are implemented in iocClock.c +// epicsTimeGetCurrent and epicsTimeGetEvent are implemented in iocClock.c diff --git a/src/libCom/osi/osiTime.cpp b/src/libCom/osi/osiTime.cpp deleted file mode 100644 index 1955baabc..000000000 --- a/src/libCom/osi/osiTime.cpp +++ /dev/null @@ -1,866 +0,0 @@ -/* - * $Id$ - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 - * - * Experimental Physics and Industrial Control System (EPICS) - * - * Copyright 1991, the Regents of the University of California, - * and the University of Chicago Board of Governors. - * - * This software was produced under U.S. Government contracts: - * (W-7405-ENG-36) at the Los Alamos National Laboratory, - * and (W-31-109-ENG-38) at Argonne National Laboratory. - * - * Initial development by: - * The Controls and Automation Group (AT-8) - * Ground Test Accelerator - * Accelerator Technology Division - * Los Alamos National Laboratory - * - * Co-developed with - * The Controls and Computing Group - * Accelerator Systems Division - * Advanced Photon Source - * Argonne National Laboratory - * - */ - -#include -#include -#include -#include -#include - -#define epicsExportSharedSymbols -#include "locationException.h" -#include "epicsAssert.h" -#include "envDefs.h" -#include "osiTime.h" -#include "tsStamp.h" - -// -// useful public constants -// -const unsigned osiTime::mSecPerSec = 1000u; -const unsigned osiTime::uSecPerSec = 1000u*osiTime::mSecPerSec; -const unsigned osiTime::nSecPerSec = 1000u*osiTime::uSecPerSec; -const unsigned osiTime::nSecPerUSec = 1000u; -const unsigned osiTime::secPerMin = 60u; - -static const unsigned ntpEpochYear = 1900; -static const unsigned ntpEpocMonth = 0; // January -static const unsigned ntpEpocDayOfTheMonth = 1; // the 1st day of the month -static const double ULONG_MAX_PLUS_ONE = (static_cast(ULONG_MAX) + 1.0); - -// -// force this module to include code that can convert -// to GDD's aitTimeStamp, but dont require that it must -// link with gdd. Therefore, gdd.h is not included here. -// -class aitTimeStamp { -public: - unsigned long tv_sec; - unsigned long tv_nsec; -}; - -static const unsigned tmStructEpochYear = 1900; - -static const unsigned epicsEpochYear = 1990; -static const unsigned epicsEpocMonth = 0; // January -static const unsigned epicsEpocDayOfTheMonth = 1; // the 1st day of the month - -// -// forward declarations for utility routines -// -static char *fracFormat (const char *pFormat, unsigned long *width); - -// -// osiTime (const unsigned long secIn, const unsigned long nSecIn) -// -inline osiTime::osiTime (const unsigned long secIn, const unsigned long nSecIn) : - secPastEpoch ( nSecIn / nSecPerSec + secIn ), nSec ( nSecIn % nSecPerSec ) {} - -// -// osiTimeLoadTimeInit -// -class osiTimeLoadTimeInit { -public: - osiTimeLoadTimeInit (); - - double epicsEpochOffset; // seconds -#ifdef NTP_SUPPORT - double ntpEpochOffset; // seconds -#endif - double time_tSecPerTick; // seconds (both NTP and EPICS use int sec) -}; - -static const osiTimeLoadTimeInit lti; - -// -// osiTimeLoadTimeInit () -// -osiTimeLoadTimeInit::osiTimeLoadTimeInit () -{ - static const time_t ansiEpoch = 0; - double secWest; - - { - time_t current = time (NULL); - time_t error; - tm date; - - gmtime_r (¤t, &date); - error = mktime (&date); - assert (error!=(time_t)-1); - secWest = difftime (error, current); - } - - { - time_t first = static_cast (0); - time_t last = static_cast (1); - this->time_tSecPerTick = difftime (last, first); - } - - { - struct tm tmEpicsEpoch; - time_t epicsEpoch; - - tmEpicsEpoch.tm_sec = 0; - tmEpicsEpoch.tm_min = 0; - tmEpicsEpoch.tm_hour = 0; - tmEpicsEpoch.tm_mday = epicsEpocDayOfTheMonth; - tmEpicsEpoch.tm_mon = epicsEpocMonth; - tmEpicsEpoch.tm_year = epicsEpochYear-tmStructEpochYear; - tmEpicsEpoch.tm_isdst = -1; // dont know if its daylight savings time - - epicsEpoch = mktime (&tmEpicsEpoch); - assert (epicsEpoch!=(time_t)-1); - this->epicsEpochOffset = difftime (epicsEpoch, ansiEpoch) - secWest; - } - -#ifdef NTP_SUPPORT - /* unfortunately, on NT mktime cant calculate a time_t for a date before 1970 */ - { - struct tm tmEpochNTP; - time_t ntpEpoch; - - tmEpochNTP.tm_sec = 0; - tmEpochNTP.tm_min = 0; - tmEpochNTP.tm_hour = 0; - tmEpochNTP.tm_mday = ntpEpocDayOfTheMonth; - tmEpochNTP.tm_mon = ntpEpocMonth; - tmEpochNTP.tm_year = ntpEpochYear-tmStructEpochYear; - tmEpochNTP.tm_isdst = -1; // dont know if its daylight savings time - - ntpEpoch = mktime (&tmEpochNTP); - assert (ntpEpoch!=(time_t)-1); - - this->ntpEpochOffset = static_cast (difftime (ansiEpoch, ntpEpoch) + this->epicsEpochOffset - secWest); - } -#endif -} - -// -// osiTime::addNanoSec () -// -// many of the UNIX timestamp formats have nano sec stored as a long -// -inline void osiTime::addNanoSec (long nSecAdj) -{ - double secAdj = static_cast (nSecAdj) / nSecPerSec; - *this += secAdj; -} - -// -// osiTime (const time_t_wrapper &tv) -// -osiTime::osiTime (const time_t_wrapper &ansiTimeTicks) -{ - static double uLongMax = static_cast (ULONG_MAX); - double sec; - - // - // map time_t, which ansi C defines as some arithmetic type, into type double - // - sec = ansiTimeTicks.ts * lti.time_tSecPerTick - lti.epicsEpochOffset; - - // - // map into the the EPICS time stamp range (which allows rollover) - // - if (sec < 0.0) { - if (sec < -uLongMax) { - sec = sec + static_cast(-sec/uLongMax)*uLongMax; - } - sec += uLongMax; - } - else if (sec > uLongMax) { - sec = sec - static_cast(sec/uLongMax)*uLongMax; - } - - this->secPastEpoch = static_cast (sec); - this->nSec = static_cast ( (sec-this->secPastEpoch) * nSecPerSec ); -} - -// -// operator time_t_wrapper () -// -osiTime::operator time_t_wrapper () const -{ - double tmp; - time_t_wrapper wrap; - - tmp = (this->secPastEpoch + lti.epicsEpochOffset) / lti.time_tSecPerTick; - tmp += (this->nSec / lti.time_tSecPerTick) / nSecPerSec; - - // - // map type double into time_t which ansi C defines as some arithmetic type - // - wrap.ts = static_cast (tmp); - - return wrap; -} - -// -// convert to and from ANSI C struct tm (with nano seconds) -// -osiTime::operator tm_nano_sec () const -{ - tm_nano_sec tm; - time_t_wrapper ansiTimeTicks; - - ansiTimeTicks = *this; - - // - // reentrant version of localtime() - from POSIX RT - // - // WRS returns int and others return &tm.ansi_tm on - // succes? - // - localtime_r (&ansiTimeTicks.ts, &tm.ansi_tm); - - tm.nSec = this->nSec; - - return tm; -} - -// -// osiTime (const tm_nano_sec &tm) -// -osiTime::osiTime (const tm_nano_sec &tm) -{ - static const time_t mktimeFailure = static_cast (-1); - time_t_wrapper ansiTimeTicks; - struct tm tmp = tm.ansi_tm; - - ansiTimeTicks.ts = mktime (&tmp); - if (ansiTimeTicks.ts == mktimeFailure) { - throwWithLocation ( formatProblemWithStructTM () ); - } - - *this = osiTime (ansiTimeTicks); - - unsigned long nSecAdj = tm.nSec % nSecPerSec; - unsigned long secAdj = tm.nSec / nSecPerSec; - *this = osiTime (this->secPastEpoch+secAdj, this->nSec+nSecAdj); -} - -// -// operator struct timespec () -// -osiTime::operator struct timespec () const -{ - struct timespec ts; - time_t_wrapper ansiTimeTicks; - - ansiTimeTicks = *this; - ts.tv_sec = ansiTimeTicks.ts; - ts.tv_nsec = static_cast (this->nSec); - return ts; -} - -// -// osiTime (const struct timespec &ts) -// -osiTime::osiTime (const struct timespec &ts) -{ - time_t_wrapper ansiTimeTicks; - - ansiTimeTicks.ts = ts.tv_sec; - *this = osiTime (ansiTimeTicks); - this->addNanoSec (ts.tv_nsec); -} - -// -// operator struct timeval () -// -osiTime::operator struct timeval () const -{ - struct timeval ts; - time_t_wrapper ansiTimeTicks; - - ansiTimeTicks = *this; - ts.tv_sec = ansiTimeTicks.ts; - ts.tv_usec = static_cast (this->nSec / nSecPerUSec); - return ts; -} - -// -// osiTime (const struct timeval &ts) -// -osiTime::osiTime (const struct timeval &ts) -{ - time_t_wrapper ansiTimeTicks; - - ansiTimeTicks.ts = ts.tv_sec; - *this = osiTime (ansiTimeTicks); - this->addNanoSec (ts.tv_usec * nSecPerUSec); -} - -// -// operator aitTimeStamp () -// -osiTime::operator aitTimeStamp () const -{ - aitTimeStamp ts; - time_t_wrapper ansiTimeTicks; - - ansiTimeTicks = *this; - ts.tv_sec = ansiTimeTicks.ts; - ts.tv_nsec = this->nSec; - return ts; -} - -// -// osiTime (const aitTimeStamp &ts) -// -osiTime::osiTime (const aitTimeStamp &ts) -{ - time_t_wrapper ansiTimeTicks; - - ansiTimeTicks.ts = ts.tv_sec; - *this = osiTime (ansiTimeTicks); - - unsigned long secAdj = ts.tv_nsec / nSecPerSec; - unsigned long nSecAdj = ts.tv_nsec % nSecPerSec; - *this = osiTime (this->secPastEpoch+secAdj, this->nSec+nSecAdj); -} - -// -// osiTime::ntpTimeStamp () -// -#ifdef NTP_SUPPORT -osiTime::operator ntpTimeStamp () const -{ - ntpTimeStamp ts; - - if (lti.ntpEpochOffset>=0) { - unsigned long offset = static_cast (lti.ntpEpochOffset); - // underflow expected - ts.l_ui = this->secPastEpoch - offset; - } - else { - unsigned long offset = static_cast (-lti.ntpEpochOffset); - // overflow expected - ts.l_ui = this->secPastEpoch + offset; - } - - ts.l_uf = static_cast ( ( this->nSec * ULONG_MAX_PLUS_ONE ) / nSecPerSec ); - - return ts; -} -#endif - -// -// osiTime::osiTime (const ntpTimeStamp &ts) -// -#ifdef NTP_SUPPORT -osiTime::osiTime (const ntpTimeStamp &ts) -{ - - if (lti.ntpEpochOffset>=0) { - unsigned long offset = static_cast (lti.ntpEpochOffset); - // overflow expected - this->secPastEpoch = ts.l_ui + this->secPastEpoch + offset; - } - else { - unsigned long offset = static_cast (-lti.ntpEpochOffset); - // underflow expected - this->secPastEpoch = ts.l_ui + this->secPastEpoch - offset; - } - - this->nSec = static_cast ( ( ts.l_uf / ULONG_MAX_PLUS_ONE ) * nSecPerSec ); -} -#endif - -// -// size_t osiTime::strftime (char *pBuff, size_t bufLength, const char *pFormat) -// -size_t osiTime::strftime (char *pBuff, size_t bufLength, const char *pFormat) const -{ - // copy format (needs to be writable) - char format[256]; - strcpy (format, pFormat); - - // look for "%0f" at the end (used for fractional second formatting) - unsigned long fracWid; - char *fracPtr = fracFormat (format, &fracWid); - - // if found, hide from strftime - if (fracPtr != NULL) *fracPtr = '\0'; - - // format all but fractional seconds - tm_nano_sec tmns = *this; - size_t numChar = ::strftime (pBuff, bufLength, format, &tmns.ansi_tm); - if (numChar == 0 || fracPtr == NULL) return numChar; - - // check there are enough chars for the fractional seconds - if (numChar + fracWid < bufLength) - { - // divisors for fraction (see below) - const int div[9+1] = {(int)1e9,(int)1e8,(int)1e7,(int)1e6,(int)1e5, - (int)1e4,(int)1e3,(int)1e2,(int)1e1,(int)1e0}; - - // round and convert nanosecs to integer of correct range - int ndp = fracWid <= 9 ? fracWid : 9; - int frac = ((tmns.nSec + div[ndp]/2) % ((int)1e9)) / div[ndp]; - - // restore fractional format and format fraction - *fracPtr = '%'; - *(format + strlen (format) - 1) = 'u'; - sprintf (pBuff+numChar, fracPtr, frac); - } - return numChar + fracWid; -} - -// -// osiTime::show (unsigned) -// -void osiTime::show (unsigned) const -{ - char bigBuffer[256]; - - size_t numChar = strftime (bigBuffer, sizeof(bigBuffer), - "%a %b %d %Y %H:%M:%S.%09f"); - if (numChar>0) { - printf ("osiTime: %s\n", bigBuffer); - } -} - -// -// osiTime::operator + (const double &rhs) -// -// rhs has units seconds -// -osiTime osiTime::operator + (const double &rhs) const -{ - unsigned long newSec, newNSec, secOffset, nSecOffset; - double fnsec; - - if (rhs >= 0) { - secOffset = static_cast (rhs); - fnsec = rhs - secOffset; - nSecOffset = static_cast (fnsec * nSecPerSec); - - newSec = this->secPastEpoch + secOffset; // overflow expected - newNSec = this->nSec + nSecOffset; - if (newNSec >= nSecPerSec) { - newSec++; // overflow expected - newNSec -= nSecPerSec; - } - } - else { - secOffset = static_cast (-rhs); - fnsec = rhs + secOffset; - nSecOffset = static_cast (-fnsec * nSecPerSec); - - newSec = this->secPastEpoch - secOffset; // underflow expected - if (this->nSec>=nSecOffset) { - newNSec = this->nSec - nSecOffset; - } - else { - // borrow - newSec--; // underflow expected - newNSec = this->nSec + (nSecPerSec - nSecOffset); - } - } - return osiTime (newSec, newNSec); -} - -// -// operator - -// -// To make this code robust during timestamp rollover events -// time stamp differences greater than one half full scale are -// interpreted as rollover situations: -// -// when RHS is greater than THIS: -// RHS-THIS > one half full scale => return THIS + (ULONG_MAX-RHS) -// RHS-THIS <= one half full scale => return -(RHS-THIS) -// -// when THIS is greater than or equal to RHS -// THIS-RHS > one half full scale => return -(RHS + (ULONG_MAX-THIS)) -// THIS-RHS <= one half full scale => return THIS-RHS -// -double osiTime::operator - (const osiTime &rhs) const -{ - double nSecRes, secRes; - - // - // first compute the difference between the nano-seconds members - // - // nano sec member is not allowed to be greater that 1/2 full scale - // so the unsigned to signed conversion is ok - // - if (this->nSec>=rhs.nSec) { - nSecRes = this->nSec - rhs.nSec; - } - else { - nSecRes = rhs.nSec - this->nSec; - nSecRes = -nSecRes; - } - - // - // next compute the difference between the seconds memebers - // and invert the sign of the nano seconds result if there - // is a range violation - // - if (this->secPastEpochsecPastEpoch; - if (secRes > ULONG_MAX/2) { - // - // In this situation where the difference is more than - // 68 years assume that the seconds counter has rolled - // over and compute the "wrap around" difference - // - secRes = 1 + (ULONG_MAX-secRes); - nSecRes = -nSecRes; - } - else { - secRes = -secRes; - } - } - else { - secRes = this->secPastEpoch - rhs.secPastEpoch; - if (secRes > ULONG_MAX/2) { - // - // In this situation where the difference is more than - // 68 years assume that the seconds counter has rolled - // over and compute the "wrap around" difference - // - secRes = 1 + (ULONG_MAX-secRes); - secRes = -secRes; - nSecRes = -nSecRes; - } - } - - return secRes + nSecRes/nSecPerSec; -} - -// -// operator <= -// -bool osiTime::operator <= (const osiTime &rhs) const -{ - bool rc; - - if (this->secPastEpochsecPastEpoch < ULONG_MAX/2) { - // - // In this situation where the difference is less than - // 69 years compute the expected result - // - rc = true; - } - else { - // - // In this situation where the difference is more than - // 69 years assume that the seconds counter has rolled - // over and compute the "wrap around" result - // - rc = false; - } - } - else if (this->secPastEpoch>rhs.secPastEpoch) { - if (this->secPastEpoch-rhs.secPastEpoch < ULONG_MAX/2) { - // - // In this situation where the difference is less than - // 69 years compute the expected result - // - rc = false; - } - else { - // - // In this situation where the difference is more than - // 69 years assume that the seconds counter has rolled - // over and compute the "wrap around" result - // - rc = true; - } - } - else { - if (this->nSec<=rhs.nSec) { - rc = true; - } - else { - rc = false; - } - } - return rc; -} - -// -// operator < -// -bool osiTime::operator < (const osiTime &rhs) const -{ - bool rc; - - if (this->secPastEpochsecPastEpoch < ULONG_MAX/2) { - // - // In this situation where the difference is less than - // 69 years compute the expected result - // - rc = true; - } - else { - // - // In this situation where the difference is more than - // 69 years assume that the seconds counter has rolled - // over and compute the "wrap around" result - // - rc = false; - } - } - else if (this->secPastEpoch>rhs.secPastEpoch) { - if (this->secPastEpoch-rhs.secPastEpoch < ULONG_MAX/2) { - // - // In this situation where the difference is less than - // 69 years compute the expected result - // - rc = false; - } - else { - // - // In this situation where the difference is more than - // 69 years assume that the seconds counter has rolled - // over and compute the "wrap around" result - // - rc = true; - } - } - else { - if (this->nSec osiTime (*pRight); - } - epicsShareFunc int epicsShareAPI tsStampGreaterThanEqual (const TS_STAMP *pLeft, const TS_STAMP *pRight) - { - return osiTime (*pLeft) >= osiTime (*pRight); - } - epicsShareFunc size_t epicsShareAPI tsStampToStrftime (char *pBuff, size_t bufLength, const char *pFormat, const TS_STAMP *pTS) - { - return osiTime(*pTS).strftime (pBuff, bufLength, pFormat); - } - epicsShareFunc void epicsShareAPI tsStampShow (const TS_STAMP *pTS, unsigned interestLevel) - { - osiTime(*pTS).show (interestLevel); - } -} - -// -// utility routines -// - -// return pointer to trailing "%0f" ( is a number) in a format string, -// NULL if none; also return and a pointer to the "f" -static char *fracFormat (const char *pFormat, unsigned long *width) -{ - // initialize returned field width - *width = 0; - - // point at char past format string - const char *ptr = pFormat + strlen (pFormat); - - // if (last) char not 'f', no match - if (*(--ptr) != 'f') return NULL; - - // skip digits, extracting (must start with 0) - while (isdigit (*(--ptr))); // NB, empty loop body - ++ptr; // points to first digit, if any - if (*ptr != '0') return NULL; - if (sscanf (ptr, "%lu", width) != 1) return NULL; - - // if (prev) char not '%', no match - if (*(--ptr) != '%') return NULL; - - // return pointer to '%' - return (char *) ptr; -} diff --git a/src/libCom/osi/osiTime.h b/src/libCom/osi/osiTime.h deleted file mode 100644 index 73f134ad9..000000000 --- a/src/libCom/osi/osiTime.h +++ /dev/null @@ -1,388 +0,0 @@ -// -// $Id$ -// -// Author Jeffrey O. Hill -// johill@lanl.gov -// 505 665 1831 -// -// Experimental Physics and Industrial Control System (EPICS) -// -// Copyright 1991, the Regents of the University of California, -// and the University of Chicago Board of Governors. -// -// This software was produced under U.S. Government contracts: -// (W-7405-ENG-36) at the Los Alamos National Laboratory, -// and (W-31-109-ENG-38) at Argonne National Laboratory. -// -// Initial development by: -// The Controls and Automation Group (AT-8) -// Ground Test Accelerator -// Accelerator Technology Division -// Los Alamos National Laboratory -// -// Co-developed with -// The Controls and Computing Group -// Accelerator Systems Division -// Advanced Photon Source -// Argonne National Laboratory -// -// -// - -#ifndef osiTimehInclude -#define osiTimehInclude - -// -// ANSI -// -#include - -#include "shareLib.h" -#include "epicsTypes.h" -#include "tsStamp.h" -#include "locationException.h" - -struct timespec; // POSIX real time -struct timeval; // BSD -class aitTimeStamp; // GDD - -// -// an extended ANSI C RTL "struct tm" which includes -// additional nano seconds within a second. -// -struct tm_nano_sec { - struct tm ansi_tm; /* ANSI C time details */ - unsigned long nSec; /* nano seconds extension */ -}; - -// -// wrapping this in a struct allows conversion to and -// from ANSI time_t but does not allow unexpected -// conversions to occur -// -struct time_t_wrapper { - time_t ts; -}; - -// -// This comment is from the NTP header files: -// -// NTP uses two fixed point formats. The first (l_fp) is the "long" -// format and is 64 bits long with the decimal between bits 31 and 32. -// This is used for time stamps in the NTP packet header (in network -// byte order) and for internal computations of offsets (in local host -// byte order). We use the same structure for both signed and unsigned -// values, which is a big hack but saves rewriting all the operators -// twice. Just to confuse this, we also sometimes just carry the -// fractional part in calculations, in both signed and unsigned forms. -// Anyway, an l_fp looks like: -// -// 0 1 2 3 -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Integral Part | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Fractional Part | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// -// -struct ntpTimeStamp { - epicsUInt32 l_ui; /* sec past NTP epoch */ - epicsUInt32 l_uf; /* fractional seconds */ -}; - -class osiTime; - -// -// type osiTimeEvent -// -class epicsShareClass osiTimeEvent -{ - friend class osiTime; -public: - osiTimeEvent (const int &eventName); -private: - unsigned eventNumber; -}; - -// -// type osiTime -// -// high resolution osiTime stamp class (struct) which can be used -// from both C++ and also from ANSI C -// -class epicsShareClass osiTime -{ -public: - - // - // exceptions - // - class unableToFetchCurrentTime {}; - class formatProblemWithStructTM {}; - - // - // fetch the current time - // - static osiTime getEvent (const osiTimeEvent &event); - static osiTime getCurrent (); - - // - // create an osiTime for the EPICS epoch - // - osiTime (); - osiTime (const osiTime &t); - osiTime & operator = (const osiTime &rhs); - - // - // convert to and from EPICS TS_STAMP format - // - operator TS_STAMP () const; - osiTime (const TS_STAMP &ts); - osiTime & operator = (const TS_STAMP &rhs); - - // - // convert to and from ANSI C's "time_t" - // - // "time_t" is wrapped in another structure to avoid - // unsuspected type conversions - // fetch value as an integer - // - operator time_t_wrapper () const; - osiTime (const time_t_wrapper &tv); - osiTime & operator = (const time_t_wrapper &rhs); - - // - // convert to and from ANSI C's "struct tm" (with nano seconds) - // - operator tm_nano_sec () const; - osiTime (const tm_nano_sec &ts); - osiTime & operator = (const tm_nano_sec &rhs); - - // - // convert to and from POSIX RT's "struct timespec" - // - operator struct timespec () const; - osiTime (const struct timespec &ts); - osiTime & operator = (const struct timespec &rhs); - - // - // convert to and from BSD's "struct timeval" - // - operator struct timeval () const; - osiTime (const struct timeval &ts); - osiTime & operator = (const struct timeval &rhs); - - // - // convert to and from NTP timestamp format - // - operator ntpTimeStamp () const; - osiTime (const ntpTimeStamp &ts); - osiTime & operator = (const ntpTimeStamp &rhs); - - // - // convert to and from GDD's aitTimeStamp format - // - operator aitTimeStamp () const; - osiTime (const aitTimeStamp &ts); - osiTime & operator = (const aitTimeStamp &rhs); - - // - // arithmetic operators - // - double operator- (const osiTime &rhs) const; // returns seconds - osiTime operator+ (const double &rhs) const; // add rhs seconds - osiTime operator- (const double &rhs) const; // subtract rhs seconds - osiTime & operator+= (const double &rhs); // add rhs seconds - osiTime & operator-= (const double &rhs); // subtract rhs seconds - - // - // comparison operators - // - bool operator == (const osiTime &rhs) const; - bool operator != (const osiTime &rhs) const; - bool operator <= (const osiTime &rhs) const; - bool operator < (const osiTime &rhs) const; - bool operator >= (const osiTime &rhs) const; - bool operator > (const osiTime &rhs) const; - - // - // convert current state to user-specified string - // - size_t strftime (char *pBuff, size_t bufLength, const char *pFormat) const; - - // - // dump current state to standard out - // - void show (unsigned interestLevel) const; - - // - // useful public constants - // - static const unsigned secPerMin; - static const unsigned mSecPerSec; - static const unsigned uSecPerSec; - static const unsigned nSecPerSec; - static const unsigned nSecPerUSec; - - // depricated - static void synchronize (); - -private: - - // - // private because: - // a) application does not break when EPICS epoch is changed - // b) no assumptions about internal storage or internal precision - // in the application - // c) it would be easy to forget which argument is nanoseconds - // and which argument is seconds (no help from compiler) - // - osiTime (const unsigned long secPastEpoch, const unsigned long nSec); - void addNanoSec (long nanoSecAdjust); - - unsigned long secPastEpoch; // seconds since O000 Jan 1, 1990 - unsigned long nSec; // nanoseconds within second -}; - -// -// type osiTime inline member functions -// - -inline osiTime::osiTime (const TS_STAMP &ts) : - secPastEpoch ( ts.secPastEpoch ), nSec ( ts.nsec ) {} - -// -// getCurrent () -// -inline osiTime osiTime::getCurrent () -{ - TS_STAMP current; - int status; - - status = tsStampGetCurrent (¤t); - if (status) { - throwWithLocation ( unableToFetchCurrentTime () ); - } - - return osiTime (current); -} - -inline osiTime osiTime::getEvent (const osiTimeEvent &event) -{ - TS_STAMP current; - int status; - - status = tsStampGetEvent (¤t, event.eventNumber); - if (status) { - throwWithLocation ( unableToFetchCurrentTime () ); - } - - return osiTime (current); -} - -inline void osiTime::synchronize () {} // depricated - -inline osiTime::osiTime () : secPastEpoch(0u), nSec(0u) {} - -inline osiTime::osiTime (const osiTime &t) : secPastEpoch (t.secPastEpoch), nSec (t.nSec) {} - -inline osiTime & osiTime::operator = ( const osiTime &t ) -{ - this->secPastEpoch = t.secPastEpoch; - this->nSec = t.nSec; - return *this; -} - -inline osiTime osiTime::operator - (const double &rhs) const -{ - return osiTime::operator + (-rhs); -} - -inline osiTime & osiTime::operator += (const double &rhs) -{ - *this = osiTime::operator + (rhs); - return *this; -} - -inline osiTime & osiTime::operator -= (const double &rhs) -{ - *this = osiTime::operator + (-rhs); - return *this; -} - -inline bool osiTime::operator == (const osiTime &rhs) const -{ - if (this->secPastEpoch == rhs.secPastEpoch && this->nSec == rhs.nSec) { - return true; - } - else { - return false; - } -} - -inline bool osiTime::operator != (const osiTime &rhs) const -{ - return !osiTime::operator == (rhs); -} - -inline bool osiTime::operator >= (const osiTime &rhs) const -{ - return ! ( *this < rhs ); -} - -inline bool osiTime::operator > (const osiTime &rhs) const -{ - return ! ( *this <= rhs ); -} - -inline osiTime & osiTime::operator = (const tm_nano_sec &rhs) -{ - *this = osiTime (rhs); - return *this; -} - -inline osiTime & osiTime::operator = (const struct timespec &rhs) -{ - *this = osiTime (rhs); - return *this; -} - -inline osiTime & osiTime::operator = (const aitTimeStamp &rhs) -{ - *this = osiTime (rhs); - return *this; -} - -inline osiTime & osiTime::operator = (const TS_STAMP &rhs) -{ - *this = osiTime (rhs); - return *this; -} - -inline osiTime::operator TS_STAMP () const -{ - TS_STAMP ts; - ts.secPastEpoch = this->secPastEpoch; - ts.nsec = this->nSec; - return ts; -} - -#ifdef NTP_SUPPORT -inline osiTime & osiTime::operator = (const ntpTimeStamp &rhs) -{ - *this = osiTime (rhs); - return *this; -} -#endif - -inline osiTime & osiTime::operator = (const time_t_wrapper &rhs) -{ - *this = osiTime (rhs); - return *this; -} - -#include "osdTime.h" - -#endif // osiTimehInclude - diff --git a/src/libCom/osi/tsStamp.h b/src/libCom/osi/tsStamp.h deleted file mode 100644 index 1f95350f4..000000000 --- a/src/libCom/osi/tsStamp.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * ANSI C manipulation of type TS_STAMP - * - * Author: Jeff Hill. - * - * Original TS_STAMP definition by Roger Cole - * - * Notes: - * 1) all functions return -1 on failure and 0 on success - * 2) the implementation of these routines is provided by - * C++ type osiTime - */ - -#ifndef tsStamph -#define tsStamph - -#include -#include "osdTime.h" - -#include "shareLib.h" -#include "epicsTypes.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define tsStampOK 0 -#define tsStampERROR (-1) - -#define tsStampEventCurrentTime 0 - -struct timeval; -struct timespec; - -/* - * The number of nanoseconds past 0000 Jan 1, 1990, GMT (or UTC). - */ -typedef struct TS_STAMP { - epicsUInt32 secPastEpoch; /* seconds since 0000 Jan 1, 1990 */ - epicsUInt32 nsec; /* nanoseconds within second */ -} TS_STAMP; - - -/* - * fetch a time stamp - */ -epicsShareFunc int epicsShareAPI tsStampGetCurrent (TS_STAMP *pDest); -epicsShareFunc int epicsShareAPI tsStampGetEvent (TS_STAMP *pDest, unsigned eventNumber); - -/* - * convert to and from ANSI C's "time_t" - */ -epicsShareFunc int epicsShareAPI tsStampToTime_t (time_t *pDest, const TS_STAMP *pSrc); -epicsShareFunc int epicsShareAPI tsStampFromTime_t (TS_STAMP *pDest, time_t src); - -/* - * convert to and from ANSI C's "struct tm" with nano seconds - */ -epicsShareFunc int epicsShareAPI tsStampToTM (struct tm *pDest, unsigned long *pNSecDest, const TS_STAMP *pSrc); -epicsShareFunc int epicsShareAPI tsStampFromTM (TS_STAMP *pDest, const struct tm *pSrc, unsigned long nSecSrc); - -/* - * convert to and from POSIX RT's "struct timespec" - */ -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 - */ -epicsShareFunc double epicsShareAPI tsStampDiffInSeconds (const TS_STAMP *pLeft, const TS_STAMP *pRight); /* returns *pLeft - *pRight in seconds */ -epicsShareFunc void epicsShareAPI tsStampAddSeconds (TS_STAMP *pDest, double secondsToAdd); /* adds seconds to *pDest */ - -/* - * comparison operations - */ -epicsShareFunc int epicsShareAPI tsStampEqual (const TS_STAMP *pLeft, const TS_STAMP *pRight); /* returns boolean result */ -epicsShareFunc int epicsShareAPI tsStampNotEqual (const TS_STAMP *pLeft, const TS_STAMP *pRight); /* returns boolean result */ -epicsShareFunc int epicsShareAPI tsStampLessThan (const TS_STAMP *pLeft, const TS_STAMP *pRight); /* returns boolean result (true if *pLeft < *pRight) */ -epicsShareFunc int epicsShareAPI tsStampLessThanEqual (const TS_STAMP *pLeft, const TS_STAMP *pRight); /* returns boolean result (true if *pLeft <= *pRight) */ -epicsShareFunc int epicsShareAPI tsStampGreaterThan (const TS_STAMP *pLeft, const TS_STAMP *pRight); /* returns boolean result (true if *pLeft > *pRight) */ -epicsShareFunc int epicsShareAPI tsStampGreaterThanEqual (const TS_STAMP *pLeft, const TS_STAMP *pRight); /* returns boolean result (true if *pLeft >= *pRight) */ - -/* - * convert to ASCII string - */ -epicsShareFunc size_t epicsShareAPI tsStampToStrftime (char *pBuff, size_t bufLength, const char *pFormat, const TS_STAMP *pTS); - -/* - * dump current state to standard out - */ -epicsShareFunc void epicsShareAPI tsStampShow (const TS_STAMP *, unsigned interestLevel); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* tsStamph */ diff --git a/src/libCom/test/Makefile b/src/libCom/test/Makefile index 1858928b0..73b900154 100644 --- a/src/libCom/test/Makefile +++ b/src/libCom/test/Makefile @@ -7,6 +7,10 @@ PROD_LIBS += Com USR_LIBS_hpux += cma +epicsTimeTestHost_SRCS += epicsTimeTestMain.cpp epicsTimeTest.cpp +PROD += epicsTimeTestHost +OBJS_IOC += epicsTimeTest + epicsThreadTestHost_SRCS += epicsThreadTestMain.cpp epicsThreadTest.cpp PROD += epicsThreadTestHost OBJS_IOC += epicsThreadTest @@ -30,9 +34,5 @@ OBJS_IOC += epicsMutexTest #fdmgrTest_SRCS += fdmgrTest.c #PROD += fdmgrTest -osiTimeTestHost_SRCS += osiTimeTestMain.c osiTimeTest.cpp -PROD += osiTimeTestHost -OBJS_IOC += osiTimeTest - include $(TOP)/configure/RULES diff --git a/src/libCom/test/epicsTimeTest.cpp b/src/libCom/test/epicsTimeTest.cpp new file mode 100644 index 000000000..f3841fbfe --- /dev/null +++ b/src/libCom/test/epicsTimeTest.cpp @@ -0,0 +1,161 @@ +#include +#include +#include + +#include "epicsTime.h" +#include "epicsThread.h" +#include "errlog.h" + +extern "C" { +int epicsTimeTest (void); +} + +int epicsTimeTest (void) +{ + unsigned i, errors, sum_errors=0, sum_errloops=0; + epicsTime begin = epicsTime::getCurrent(); + const unsigned wasteTime = 100000u; + const int nTimes = 100; + epicsTimeStamp stamp; + struct timespec ts; + struct tm tmAnsi; + tm_nano_sec ansiDate; + unsigned long nanoSec; + double diff; + + printf ("epicsTime Test (%3d loops)\n========================\n\n", nTimes); + + for (int iTimes=0; iTimes < nTimes; ++iTimes) { + for (i=0; i=end)) { + printf ("#%3d: Failed copy>=end by %12.9f\n", + iTimes, (end-copy)); + errors += 1; + } + if (!(end>begin)) { + printf ("#%3d: Failed end>begin by %12.9f\n", + iTimes, (begin-end)); + errors += 1; + } + if (!(end>=begin)) { + printf ("#%3d: Failed end>=begin by %12.9f\n", + iTimes, (begin-end)); + errors += 1; + } + if (!(begin + +extern "C" int epicsTimeTest (void); + +int main (int , char **) +{ + return epicsTimeTest (); +} diff --git a/src/libCom/test/fdmgrTest.c b/src/libCom/test/fdmgrTest.c index 800537019..db0497003 100644 --- a/src/libCom/test/fdmgrTest.c +++ b/src/libCom/test/fdmgrTest.c @@ -3,7 +3,7 @@ #include #include "fdmgr.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "epicsAssert.h" static const unsigned uSecPerSec = 1000000; @@ -39,14 +39,14 @@ void fdCreateDestroyHandler (void *pArg, int fd, int open) } typedef struct cbStuctTimer { - osiTime time; + epicsTime time; int done; } cbStruct; void alarmCB (void *parg) { cbStruct *pCBS = (cbStruct *) parg; - osiTimeGetCurrent (&pCBS->time); + epicsTimeGetCurrent (&pCBS->time); pCBS->done = 1; } @@ -55,12 +55,12 @@ void testTimer (fdctx *pfdm, double delay) int status; fdmgrAlarmId aid; struct timeval tmo; - osiTime begin; + epicsTime begin; cbStruct cbs; double measuredDelay; double measuredError; - osiTimeGetCurrent (&begin); + epicsTimeGetCurrent (&begin); cbs.done = 0; tmo.tv_sec = (unsigned long) delay; tmo.tv_usec = (unsigned long) ((delay - tmo.tv_sec) * uSecPerSec); @@ -74,7 +74,7 @@ void testTimer (fdctx *pfdm, double delay) assert (status==0); } - measuredDelay = osiTimeDiffInSeconds (&cbs.time, &begin); + measuredDelay = epicsTimeDiffInSeconds (&cbs.time, &begin); measuredError = fabs (measuredDelay-delay); printf ("measured delay for %lf sec was off by %lf sec (%lf %%)\n", delay, measuredError, 100.0*measuredError/delay); diff --git a/src/libCom/test/osiTimeTest.cpp b/src/libCom/test/osiTimeTest.cpp deleted file mode 100644 index d22a739a0..000000000 --- a/src/libCom/test/osiTimeTest.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include -#include -#include - -#include "osiTime.h" -#include "epicsThread.h" -#include "errlog.h" - -extern "C" { -int osiTimeTest (void); -} - -int osiTimeTest (void) -{ - unsigned i, errors, sum_errors=0, sum_errloops=0; - osiTime begin = osiTime::getCurrent(); - const unsigned wasteTime = 100000u; - const int nTimes = 100; - TS_STAMP stamp; - struct timespec ts; - struct tm tmAnsi; - tm_nano_sec ansiDate; - unsigned long nanoSec; - double diff; - - printf ("osiTime Test (%3d loops)\n========================\n\n", nTimes); - - for (int iTimes=0; iTimes < nTimes; ++iTimes) { - for (i=0; i=end)) { - printf ("#%3d: Failed copy>=end by %12.9f\n", - iTimes, (end-copy)); - errors += 1; - } - if (!(end>begin)) { - printf ("#%3d: Failed end>begin by %12.9f\n", - iTimes, (begin-end)); - errors += 1; - } - if (!(end>=begin)) { - printf ("#%3d: Failed end>=begin by %12.9f\n", - iTimes, (begin-end)); - errors += 1; - } - if (!(begin - -int osiTimeTest (void); - -int main (int argc, char **argv) -{ -#ifdef HP_UX - _main(); -#endif - return osiTimeTest (); -} diff --git a/src/libCom/test/timerTest.c b/src/libCom/test/timerTest.c index 58025439e..8d3f9f7f0 100644 --- a/src/libCom/test/timerTest.c +++ b/src/libCom/test/timerTest.c @@ -17,7 +17,7 @@ of this distribution. #include "epicsThread.h" #include "osiTimer.h" #include "errlog.h" -#include "tsStamp.h" +#include "epicsTime.h" static void expire(void *pPrivate); static void destroy(void *pPrivate); @@ -30,7 +30,7 @@ static osiTimerQueueId timerQueue; typedef struct myPvt { osiTimerId timer; double requestedDiff; - TS_STAMP start; + epicsTimeStamp start; }myPvt; @@ -39,14 +39,14 @@ typedef struct myPvt { void timerTest(void) { myPvt *timer[ntimers]; - TS_STAMP start; + epicsTimeStamp start; int i; timerQueue = osiTimerQueueCreate(epicsThreadPriorityLow); for(i=0; itimer = osiTimerCreate(&jumpTable,timerQueue,(void *)timer[i]); - tsStampGetCurrent(&start); + epicsTimeGetCurrent(&start); timer[i]->start = start; timer[i]->requestedDiff = (double)i; osiTimerArm(timer[i]->timer,(double)i); @@ -58,11 +58,11 @@ void timerTest(void) void expire(void *pPrivate) { myPvt *pmyPvt = (myPvt *)pPrivate; - TS_STAMP end; + epicsTimeStamp end; double diff; - tsStampGetCurrent(&end); - diff = tsStampDiffInSeconds(&end,&pmyPvt->start); + epicsTimeGetCurrent(&end); + diff = epicsTimeDiffInSeconds(&end,&pmyPvt->start); printf("myCallback requestedDiff %f diff %f\n",pmyPvt->requestedDiff,diff); } diff --git a/src/libCom/timer/osiTimer.cpp b/src/libCom/timer/osiTimer.cpp index 5c390d306..b86685106 100644 --- a/src/libCom/timer/osiTimer.cpp +++ b/src/libCom/timer/osiTimer.cpp @@ -261,7 +261,7 @@ void osiTimer::arm (double initialDelay) // // calculate absolute expiration time // - this->exp = osiTime::getCurrent () + initialDelay; + this->exp = epicsTime::getCurrent () + initialDelay; // // insert into the pending queue @@ -351,7 +351,7 @@ double osiTimer::delay () const // void osiTimer::show (unsigned level) const { - osiTime cur = osiTime::getCurrent (); + epicsTime cur = epicsTime::getCurrent (); printf ("osiTimer at %p for \"%s\" with again = %d\n", this, this->name(), this->again()); if (level>=1u) { @@ -384,7 +384,7 @@ double osiTimer::timeRemaining () const this->queue.mutex.lock (); switch (this->curState) { case statePending: - delay = this->exp - osiTime::getCurrent(); + delay = this->exp - epicsTime::getCurrent(); if ( delay < 0.0 ) { delay = 0.0; } @@ -529,7 +529,7 @@ double osiTimerQueue::delayToFirstExpire () const // // no timer in the queue - return a long delay - 30 min // - delay = 30u * osiTime::secPerMin; + delay = 30u * epicsTime::secPerMin; } this->mutex.unlock (); @@ -549,7 +549,7 @@ void osiTimerQueue::process () void osiTimerQueue::privateProcess () { - osiTime cur ( osiTime::getCurrent () ); + epicsTime cur ( epicsTime::getCurrent () ); osiTimer *pTmr; this->mutex.lock (); @@ -717,7 +717,7 @@ extern "C" epicsShareFunc double epicsShareAPI osiTimerTimeRemaining (osiTimerId return pTmr->timeRemaining (); } -extern "C" epicsShareFunc TS_STAMP epicsShareAPI osiTimerExpirationDate (osiTimerId idIn) +extern "C" epicsShareFunc epicsTimeStamp epicsShareAPI osiTimerExpirationDate (osiTimerId idIn) { osiTimerForC *pTmr = static_cast (idIn); assert (pTmr); diff --git a/src/libCom/timer/osiTimer.h b/src/libCom/timer/osiTimer.h index 8c270f174..a00d43f92 100644 --- a/src/libCom/timer/osiTimer.h +++ b/src/libCom/timer/osiTimer.h @@ -33,11 +33,11 @@ #include "shareLib.h" /* reset share lib defines */ #include "epicsThread.h" -#include "tsStamp.h" +#include "epicsTime.h" #ifdef __cplusplus -#include "osiTime.h" +#include "epicsTime.h" #include "tsDLList.h" #include "epicsMutex.h" #include "epicsEvent.h" @@ -105,7 +105,7 @@ public: * respectively */ epicsShareFunc double timeRemaining () const; /* returns seconds, but inefficent */ - epicsShareFunc osiTime expirationDate () const; /* efficent */ + epicsShareFunc epicsTime expirationDate () const; /* efficent */ /* * called when the osiTimer expires @@ -161,7 +161,7 @@ private: enum state {statePending, stateExpired, stateIdle, numberOfTimerLists, stateLimbo}; - osiTime exp; /* experation time */ + epicsTime exp; /* experation time */ state curState; /* current state */ osiTimerQueue &queue; /* pointer to current timer queue */ @@ -212,7 +212,7 @@ private: */ epicsShareExtern osiTimerQueue osiDefaultTimerQueue; -inline osiTime osiTimer::expirationDate () const +inline epicsTime osiTimer::expirationDate () const { return this->exp; } @@ -243,7 +243,7 @@ epicsShareFunc osiTimerId epicsShareAPI osiTimerCreate (const osiTimerJumpTable epicsShareFunc void epicsShareAPI osiTimerArm (osiTimerId, double delay); epicsShareFunc void epicsShareAPI osiTimerCancel (osiTimerId); epicsShareFunc double epicsShareAPI osiTimerTimeRemaining (osiTimerId); -epicsShareFunc TS_STAMP epicsShareAPI osiTimerExpirationDate (osiTimerId); +epicsShareFunc epicsTimeStamp epicsShareAPI osiTimerExpirationDate (osiTimerId); #ifdef __cplusplus } diff --git a/src/libCom/tsDefs/tsDefs.c b/src/libCom/tsDefs/tsDefs.c index 5b0b8d24c..4cc29fd41 100644 --- a/src/libCom/tsDefs/tsDefs.c +++ b/src/libCom/tsDefs/tsDefs.c @@ -9,10 +9,10 @@ epicsShareFunc char * epicsShareAPI tsStampToText(const TS_STAMP *pTS,enum tsTex { switch (textType) { case TS_TEXT_MMDDYY: - tsStampToStrftime(textBuffer,28,"%m/%d/%y %H:%M:%S.%09f",pTS); + epicsTimeToStrftime(textBuffer,28,"%m/%d/%y %H:%M:%S.%09f",pTS); break; case TS_TEXT_MONDDYYYY: - tsStampToStrftime(textBuffer,32,"%b %d, %Y %H:%M:%S.%09f",pTS); + epicsTimeToStrftime(textBuffer,32,"%b %d, %Y %H:%M:%S.%09f",pTS); break; default: return NULL; @@ -22,6 +22,6 @@ epicsShareFunc char * epicsShareAPI tsStampToText(const TS_STAMP *pTS,enum tsTex epicsShareFunc long epicsShareAPI tsLocalTime(TS_STAMP *pStamp) { - return tsStampGetCurrent(pStamp); + return epicsTimeGetCurrent(pStamp); } diff --git a/src/libCom/tsDefs/tsDefs.h b/src/libCom/tsDefs/tsDefs.h index e0f6f40d3..f95bb0fd0 100644 --- a/src/libCom/tsDefs/tsDefs.h +++ b/src/libCom/tsDefs/tsDefs.h @@ -10,6 +10,7 @@ #ifndef tsDefsh #define tsDefsh +#include "epicsTime.h" #include "shareLib.h" #ifdef __cplusplus @@ -17,7 +18,6 @@ extern "C" { #endif #define epicsExportSharedSymbols -#include "tsStamp.h" /*---------------------------------------------------------------------------- * TS_TEXT_xxx text type codes for converting between text and time stamp diff --git a/src/makeBaseApp/top/exampleApp/src/caMonitor.c b/src/makeBaseApp/top/exampleApp/src/caMonitor.c index a6cce1e2e..7c815cb69 100644 --- a/src/makeBaseApp/top/exampleApp/src/caMonitor.c +++ b/src/makeBaseApp/top/exampleApp/src/caMonitor.c @@ -7,7 +7,6 @@ #include #include -#include "tsStamp.h" #include "cadef.h" #include "dbDefs.h" diff --git a/src/misc/iocInit.c b/src/misc/iocInit.c index c0bf309f6..42eb23de9 100644 --- a/src/misc/iocInit.c +++ b/src/misc/iocInit.c @@ -54,7 +54,6 @@ of this distribution. #include "dbDefs.h" #include "epicsThread.h" #include "epicsPrint.h" -#include "tsStamp.h" #include "ellLib.h" #include "dbDefs.h" #include "dbBase.h" diff --git a/src/rec/aaiRecord.c b/src/rec/aaiRecord.c index d32b6ec0f..f77575cb1 100644 --- a/src/rec/aaiRecord.c +++ b/src/rec/aaiRecord.c @@ -48,7 +48,6 @@ #include "epicsPrint.h" #include "alarm.h" -#include "tsStamp.h" #include "dbAccess.h" #include "dbScan.h" #include "dbEvent.h" diff --git a/src/rsrv/camessage.c b/src/rsrv/camessage.c index 77ded0f78..6292c80ac 100644 --- a/src/rsrv/camessage.c +++ b/src/rsrv/camessage.c @@ -35,7 +35,7 @@ #include "osiSock.h" #include "epicsEvent.h" #include "epicsMutex.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "errlog.h" #include "db_access_routines.h" #include "db_access.h" @@ -916,7 +916,7 @@ unsigned cid return NULL; } ellInit(&pchannel->eventq); - tsStampGetCurrent(&pchannel->time_at_creation); + epicsTimeGetCurrent(&pchannel->time_at_creation); pchannel->addr = *pAddr; pchannel->client = client; /* diff --git a/src/rsrv/camsgtask.c b/src/rsrv/camsgtask.c index 4c1adae0a..1d0bcb06b 100644 --- a/src/rsrv/camsgtask.c +++ b/src/rsrv/camsgtask.c @@ -36,7 +36,7 @@ #include "dbDefs.h" #include "osiSock.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "errlog.h" #include "taskwd.h" #include "db_access.h" @@ -84,7 +84,7 @@ void camsgtask (struct client *client) break; } - tsStampGetCurrent (&client->time_at_last_recv); + epicsTimeGetCurrent (&client->time_at_last_recv); client->recv.cnt += (unsigned long) nchars; status = camessage (client, &client->recv); diff --git a/src/rsrv/caserverio.c b/src/rsrv/caserverio.c index 0ed8c8155..f833d9f05 100644 --- a/src/rsrv/caserverio.c +++ b/src/rsrv/caserverio.c @@ -35,7 +35,7 @@ #include "dbDefs.h" #include "osiSock.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "errlog.h" #include "net_convert.h" @@ -149,7 +149,7 @@ void cas_send_msg (struct client *pclient, int lock_needed) } pclient->send.stk = 0; - tsStampGetCurrent (&pclient->time_at_last_send); + epicsTimeGetCurrent (&pclient->time_at_last_send); } if(lock_needed){ diff --git a/src/rsrv/caservertask.c b/src/rsrv/caservertask.c index 9ea13ec8a..205215b3f 100644 --- a/src/rsrv/caservertask.c +++ b/src/rsrv/caservertask.c @@ -39,7 +39,7 @@ #include "osiSock.h" #include "epicsEvent.h" #include "epicsMutex.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "errlog.h" #include "taskwd.h" #include "addrList.h" @@ -117,8 +117,8 @@ struct client *create_base_client () client->recv.cnt = 0ul; client->evuser = NULL; client->disconnect = FALSE; /* for TCP only */ - tsStampGetCurrent(&client->time_at_last_send); - tsStampGetCurrent(&client->time_at_last_recv); + epicsTimeGetCurrent(&client->time_at_last_send); + epicsTimeGetCurrent(&client->time_at_last_recv); client->proto = IPPROTO_UDP; client->minor_version_number = CA_UKN_MINOR_VERSION; @@ -485,7 +485,7 @@ LOCAL void log_one_client (struct client *client, unsigned level) double recv_delay; unsigned long bytes_reserved; char *state[] = {"up", "down"}; - TS_STAMP current; + epicsTimeStamp current; char clientHostName[256]; ipAddrToDottedIP (&client->addr, clientHostName, sizeof(clientHostName)); @@ -500,9 +500,9 @@ LOCAL void log_one_client (struct client *client, unsigned level) pproto = "UKN"; } - tsStampGetCurrent(¤t); - send_delay = tsStampDiffInSeconds(¤t,&client->time_at_last_send); - recv_delay = tsStampDiffInSeconds(¤t,&client->time_at_last_recv); + epicsTimeGetCurrent(¤t); + send_delay = epicsTimeDiffInSeconds(¤t,&client->time_at_last_send); + recv_delay = epicsTimeDiffInSeconds(¤t,&client->time_at_last_recv); printf( "%s(%s): User=\"%s\", V%d.%u, Channel Count=%d\n", clientHostName, diff --git a/src/rsrv/cast_server.c b/src/rsrv/cast_server.c index c4a1cb855..448c1f863 100644 --- a/src/rsrv/cast_server.c +++ b/src/rsrv/cast_server.c @@ -54,7 +54,7 @@ #include "dbDefs.h" #include "errlog.h" #include "taskwd.h" -#include "tsStamp.h" +#include "epicsTime.h" #include "envDefs.h" #include "freeList.h" @@ -69,14 +69,14 @@ LOCAL void clean_addrq() { struct channel_in_use *pciu; struct channel_in_use *pnextciu; - TS_STAMP current; + epicsTimeStamp current; double delay; double maxdelay = 0; unsigned ndelete=0; double timeout = TIMEOUT; int s; - tsStampGetCurrent(¤t); + epicsTimeGetCurrent(¤t); epicsMutexMustLock(prsrv_cast_client->addrqLock); pnextciu = (struct channel_in_use *) @@ -85,7 +85,7 @@ LOCAL void clean_addrq() while( (pciu = pnextciu) ) { pnextciu = (struct channel_in_use *)pciu->node.next; - delay = tsStampDiffInSeconds(¤t,&pciu->time_at_creation); + delay = epicsTimeDiffInSeconds(¤t,&pciu->time_at_creation); if (delay > timeout) { ellDelete(&prsrv_cast_client->addrq, &pciu->node); @@ -260,7 +260,7 @@ int cast_server(void) else { prsrv_cast_client->recv.cnt = (unsigned long) status; prsrv_cast_client->recv.stk = 0ul; - tsStampGetCurrent(&prsrv_cast_client->time_at_last_recv); + epicsTimeGetCurrent(&prsrv_cast_client->time_at_last_recv); /* * If we are talking to a new client flush to the old one diff --git a/src/rsrv/online_notify.c b/src/rsrv/online_notify.c index 691b3a914..0c47ddfcb 100644 --- a/src/rsrv/online_notify.c +++ b/src/rsrv/online_notify.c @@ -43,7 +43,6 @@ #include "dbDefs.h" #include "osiSock.h" #include "osiPoolStatus.h" -#include "tsStamp.h" #include "errlog.h" #include "envDefs.h" #include "addrList.h" diff --git a/src/rsrv/server.h b/src/rsrv/server.h index 805349831..66d6cedf9 100644 --- a/src/rsrv/server.h +++ b/src/rsrv/server.h @@ -43,6 +43,7 @@ #include "dbNotify.h" #include "caProto.h" #include "ellLib.h" +#include "epicsTime.h" #include "epicsAssert.h" #define epicsExportSharedSymbols @@ -101,8 +102,8 @@ struct client { ELLLIST addrq; ELLLIST putNotifyQue; struct sockaddr_in addr; - TS_STAMP time_at_last_send; - TS_STAMP time_at_last_recv; + epicsTimeStamp time_at_last_send; + epicsTimeStamp time_at_last_recv; void *evuser; char *pUserName; char *pHostName; @@ -138,7 +139,7 @@ struct channel_in_use { RSRVPUTNOTIFY *pPutNotify; /* potential active put notify */ const unsigned cid; /* client id */ const unsigned sid; /* server id */ - TS_STAMP time_at_creation; /* for UDP timeout */ + epicsTimeStamp time_at_creation; /* for UDP timeout */ struct dbAddr addr; ASCLIENTPVT asClientPVT; }; diff --git a/src/util/ca_test.c b/src/util/ca_test.c index 141d5ab67..e588d0b62 100644 --- a/src/util/ca_test.c +++ b/src/util/ca_test.c @@ -48,7 +48,7 @@ #endif #include "cadef.h" -#include "tsStamp.h" +#include "epicsTime.h" int ca_test(char *pname, char *pvalue); LOCAL int cagft(char *pname); @@ -520,7 +520,7 @@ LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count) struct dbr_time_string *pvalue = (struct dbr_time_string *) pbuffer; - tsStampToStrftime(tsString,sizeof(tsString), + epicsTimeToStrftime(tsString,sizeof(tsString), "%Y/%m/%d %H:%M:%S.%06f",&pvalue->stamp); printf("%2d %2d",pvalue->status,pvalue->severity); printf("\tTimeStamp: %s",tsString); @@ -534,7 +534,7 @@ LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count) = (struct dbr_time_enum *)pbuffer; dbr_enum_t *pshort = &pvalue->value; - tsStampToStrftime(tsString,sizeof(tsString), + epicsTimeToStrftime(tsString,sizeof(tsString), "%Y/%m/%d %H:%M:%S.%06f",&pvalue->stamp); printf("%2d %2d",pvalue->status,pvalue->severity); printf("\tTimeStamp: %s",tsString); @@ -551,7 +551,7 @@ LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count) = (struct dbr_time_short *)pbuffer; dbr_short_t *pshort = &pvalue->value; - tsStampToStrftime(tsString,sizeof(tsString), + epicsTimeToStrftime(tsString,sizeof(tsString), "%Y/%m/%d %H:%M:%S.%06f",&pvalue->stamp); printf("%2d %2d", pvalue->status, @@ -570,7 +570,7 @@ LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count) = (struct dbr_time_float *)pbuffer; dbr_float_t *pfloat = &pvalue->value; - tsStampToStrftime(tsString,sizeof(tsString), + epicsTimeToStrftime(tsString,sizeof(tsString), "%Y/%m/%d %H:%M:%S.%06f",&pvalue->stamp); printf("%2d %2d",pvalue->status,pvalue->severity); printf("\tTimeStamp: %s",tsString); @@ -587,7 +587,7 @@ LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count) = (struct dbr_time_char *)pbuffer; dbr_char_t *pchar = &pvalue->value; - tsStampToStrftime(tsString,sizeof(tsString), + epicsTimeToStrftime(tsString,sizeof(tsString), "%Y/%m/%d %H:%M:%S.%06f",&pvalue->stamp); printf("%2d %2d",pvalue->status,pvalue->severity); printf("\tTimeStamp: %s",tsString); @@ -604,7 +604,7 @@ LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count) = (struct dbr_time_long *)pbuffer; dbr_long_t *plong = &pvalue->value; - tsStampToStrftime(tsString,sizeof(tsString), + epicsTimeToStrftime(tsString,sizeof(tsString), "%Y/%m/%d %H:%M:%S.%06f",&pvalue->stamp); printf("%2d %2d",pvalue->status,pvalue->severity); printf("\tTimeStamp: %s",tsString); @@ -621,7 +621,7 @@ LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count) = (struct dbr_time_double *)pbuffer; dbr_double_t *pdouble = &pvalue->value; - tsStampToStrftime(tsString,sizeof(tsString), + epicsTimeToStrftime(tsString,sizeof(tsString), "%Y/%m/%d %H:%M:%S.%06f",&pvalue->stamp); printf("%2d %2d",pvalue->status,pvalue->severity); printf("\tTimeStamp: %s",tsString); diff --git a/src/vxWorks/db/drvTS.c b/src/vxWorks/db/drvTS.c index fe7569156..39be68ac8 100644 --- a/src/vxWorks/db/drvTS.c +++ b/src/vxWorks/db/drvTS.c @@ -13,6 +13,9 @@ /* * $Log$ + * Revision 1.40 2000/12/15 15:34:40 mrk + * remove unnecessary calls to TSinit + * * Revision 1.39 2000/10/11 23:08:56 anj * Fixed bug in TSgetMasterTime() - round-trip adjustment was garbage * Replaced TSprintf() with printf() where logging inappropriate @@ -587,7 +590,7 @@ long TSinit(void) if(TSinitialized) return(0); /*register with iocClock */ - iocClockRegister((ptsStampGetCurrent)TScurrentTimeStamp,getEvent); + iocClockRegister((pepicsTimeGetCurrent)TScurrentTimeStamp,getEvent); TSinitialized = 1; /* 0=default, 1=none, 2=direct */ diff --git a/src/vxWorks/db/drvTS.h b/src/vxWorks/db/drvTS.h index 4eefc2a92..6c4f476b8 100644 --- a/src/vxWorks/db/drvTS.h +++ b/src/vxWorks/db/drvTS.h @@ -3,6 +3,9 @@ /* * $Log$ + * Revision 1.7 2000/02/02 20:06:25 mrk + * new way to build + * * Revision 1.6 1999/12/14 21:35:34 jhill * use osiTime.h to get TS_STAMP * @@ -79,7 +82,7 @@ of this distribution. #include #include -#include "tsStamp.h" +#include "epicsTime.h" #ifdef TS_DRIVER #define TS_EXTERN