g+
g+ Communities
Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013 
<== Date ==> <== Thread ==>

Subject: Re: IOC to use time from its own processor
From: Dehong Zhang <dhzhang@fnal.gov>
To: Andrew Johnson <anj@aps.anl.gov>
Cc: tech-talk@aps.anl.gov
Date: Thu, 06 Nov 2008 09:53:43 -0600
Hi Andrew,

Sorry to bother you again.

I made up a method like:

#include "epicsTime.h"

epicsTime getCurrent()
{
    struct timespec ts;

    clock_gettime( CLOCK_REALTIME, &ts );
    return epicsTime ( ts );
}

Can i invoke iocClockRegister(&getCurrent, NULL) in the vxWorks
startup script (how ?), or I have to wrap it with a simple command so that
it can be invoked before iocInit?

Thanks and best regards,
Dehong




----- Original Message -----
From: Andrew Johnson <anj@aps.anl.gov>
Date: Tuesday, November 4, 2008 1:25 pm
Subject: Re: IOC to use time from its own processor
To: Dehong Zhang <dhzhang@fnal.gov>
Cc: tech-talk@aps.anl.gov


> Hi,
> 
> On Tuesday 04 November 2008 10:18:17 Dehong Zhang wrote:
> >
> > We are using R3.14.8.  Could you please tell me how to do it with
> > both 3.14.8 and 3.14.10?  We may upgrade soon.
> 
> > > On Tuesday 04 November 2008 09:30:01 Dehong Zhang wrote:
> > > > How can I force an IOC to use the time from its own system,
> > > > instead of reaching out to the master timestamp server or the
> > > > boot host?
> 
> I'm going to assume that you're asking about IOCs running on vxWorks; 
> RTEMS is 
> a little different, but any workstation OS is already using the system 
> clock 
> to obtain the current time.
> 
> If your vxWorks boot image already has software included to 
> synchronize the OS 
> clock to an external time source, you can probably get away with just 
> setting 
> the EPICS_TS_NTP_INET environment variable to 127.0.0.1.  This will 
> stop it 
> from contacting the boot host, and all attempts to get the time over 
> NTP will 
> fail (unless your IOC is also acting as an NTP server; if that's the 
> case, 
> use the IP address of a machine that will never respond to NTP 
> requests).  
> One disadvantage of this approach is that you'll get one error message 
> during 
> IOC initialization when the sync fails.
> 
> To avoid that error, in R3.14.8 you can register your own time 
> provider 
> routine in place of the regular EPICS one as long as you do so before 
> 
> iocInit().  Your code should #include "iocClock.h" and call 
> iocClockRegister(&getCurrent, NULL) where getCurrent is your provider 
> 
> routine.
> 
> For R3.14.10 you should look at the new API in R3.14.10 which 
> implements a 
> pluggable time and event provider management subsystem.  That's 
> documented in 
> the Application Developers Guide sections 9.7 and 20.6.
> 
> HTH,
> 
> - Andrew
> -- 
> Talk is cheap. Show me the code. -- Linus Torvalds

Replies:
Re: IOC to use time from its own processor Andrew Johnson
References:
IOC to use time from its own processor Dehong Zhang
Re: IOC to use time from its own processor Andrew Johnson
Re: IOC to use time from its own processor Dehong Zhang
Re: IOC to use time from its own processor Andrew Johnson

Navigate by Date:
Prev: RE: edm (tabs) Cobb, TM (Tom)
Next: Re: IOC to use time from its own processor Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013 
Navigate by Thread:
Prev: Re: IOC to use time from its own processor Andrew Johnson
Next: Re: IOC to use time from its own processor Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICSv4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·