diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 366721455..afb7787d3 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -19,6 +19,16 @@ --> +

Support for event codes greater than or equal to NUM_TIME_EVENTS

+ +

Event numbers greater than or equal to NUM_TIME_EVENTS are now allowed if +supported by the registered event time provider, which must provide its own +advancing timestamp validation for such events.

+ +

Time events numbered 0 through (NUM_TIME_EVENTS-1) are still validated by +code in epicsGeneralTime.c that checks for advancing timestamps and enforces +that restriction.

+

Type-safe Device and Driver Support Tables

Type-safe versions of the device and driver support structures dset diff --git a/src/libCom/osi/epicsGeneralTime.c b/src/libCom/osi/epicsGeneralTime.c index 3054175ef..d08e9c6a9 100644 --- a/src/libCom/osi/epicsGeneralTime.c +++ b/src/libCom/osi/epicsGeneralTime.c @@ -225,14 +225,14 @@ static int generalTimeGetEventPriority(epicsTimeStamp *pDest, int eventNumber, gtProvider *ptp; int status = S_time_noProvider; epicsTimeStamp ts; + STATIC_ASSERT ( epicsTimeEventBestTime == -1 ); generalTime_Init(); IFDEBUG(2) printf("generalTimeGetEventPriority(eventNum=%d)\n", eventNumber); - if ((eventNumber < 0 || eventNumber >= NUM_TIME_EVENTS) && - (eventNumber != epicsTimeEventBestTime)) + if (eventNumber < epicsTimeEventBestTime) return S_time_badEvent; epicsMutexMustLock(gtPvt.eventListLock); @@ -245,7 +245,9 @@ static int generalTimeGetEventPriority(epicsTimeStamp *pDest, int eventNumber, if (pPrio) *pPrio = ptp->priority; - if (eventNumber == epicsTimeEventBestTime) { + if (eventNumber >= NUM_TIME_EVENTS) { + *pDest = ts; + } else if (eventNumber == epicsTimeEventBestTime) { if (epicsTimeGreaterThanEqual(&ts, >Pvt.lastProvidedBestTime)) { *pDest = ts; diff --git a/src/libCom/osi/epicsGeneralTime.h b/src/libCom/osi/epicsGeneralTime.h index 3adc23705..6bbb0b21b 100644 --- a/src/libCom/osi/epicsGeneralTime.h +++ b/src/libCom/osi/epicsGeneralTime.h @@ -17,7 +17,11 @@ extern "C" { #endif #define NUM_TIME_EVENTS 256 -/* Time Events are numbered 0 through (NUM_TIME_EVENTS-1) */ +/* Time Events numbered 0 through (NUM_TIME_EVENTS-1) are validated by */ +/* code in epicsGeneralTime.c that tests for advancing timestamps and */ +/* enforces that restriction. Event numbers greater than or equal to */ +/* NUM_TIME_EVENTS are now allowed if supported by a custom time provider */ +/* which should provide its own advancing timestamp validation. */ epicsShareFunc void generalTime_Init(void);