Hi,
Congratulations, you discovered one of the reasons that we completely replaced
the way the IOC code gets the current time in Base R3.14.10. The older code
does work well enough for soft timing IOCs, but it is not obvious exactly how
it does it.
On 2011-05-30 you wrote:
> But in the EPICS3.14.8.2, this routine is like this:
> int iocClockGetEvent(epicsTimeStamp *pDest, int eventNumber)
> {
> if (eventNumber==epicsTimeEventCurrentTime) {
> *pDest = piocClockPvt->clock;
> return(0);
> }
> return(epicsTimeERROR);
> }
> Which does not call routine iocClockGetCurrent(), instead, just return the
> value of piocClockPvt->clock. And I can not find another routine who calls
> iocClockGetCurrent() except date(). So I think when a record is being
> processed, if both the field TSE and TSEL are 0, then recGblGetTimeStamp()
> calls epicsTimeGetEvent(), epicsTimeGetEvent() calls iocClockGetEvent(),
> iocClockGetEvent() returns the value of piocClockPvt->clock, but by this
> sequence, piocClockPvt->clock seem to be static and updated only by ntp
> server every 10 second, and how does the record get the updated EPICS
> time every time it is processed? As I have tested on
> MVME5100/VxWorks5.5.1, a record with a "1 second" SCAN field get the
> updated TIME field value every second very well, but I do not understand
> how EPICS achieve this.
In R3.14.8.2 piocClockPvt->clock is set by the syncNTP() routine every 10
seconds, but is also adjusted every time any other code in the IOC calls
epicsTimeGetCurrent() since that ends up calling iocClockGetCurrent(). There
are many calls to that routine, and in particular the code that implements the
periodic scan threads calls it before and after triggering every periodic
scan, so it should always be right to within 0.1 seconds (or whatever your
fastest scan rate is) and better if you only have a few records in your
periodic scan.
If you need better accuracy your IOC will contain some kind of hardware timing
or event system, which replaces the iocClockGetEvent() routine with its own
code by calling iocClockRegister() and thus avoids the bug that you have seen.
As I said above, in newer releases of EPICS Base we have replaced this code
with a better implementation called "general time" which does properly fetch
the current time from the OS every time a record processes.
- Andrew
--
Optimization is the process of taking something that works and
replacing it with something that almost works, but costs less.
-- Roger Needham
- Navigate by Date:
- Prev:
RE: asyn driver on Windows XP Jeff Hill
- Next:
Sequencer news: latest snapshot builds and runs under Windows Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
RE: asyn driver on Windows XP Mark Rivers
- Next:
Sequencer news: latest snapshot builds and runs under Windows Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|