EPICS Controls 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  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: IOC to use time from its own processor
From: Andrew Johnson <[email protected]>
To: Dehong Zhang <[email protected]>
Cc: [email protected]
Date: Thu, 6 Nov 2008 10:54:05 -0600
Hi Dehong,

On Thursday 06 November 2008 09:53:43 Dehong Zhang wrote:
>
> I made up a method like:
>
> #include "epicsTime.h"
>
> epicsTime getCurrent()
> {
>     struct timespec ts;
>
>     clock_gettime( CLOCK_REALTIME, &ts );
>     return epicsTime ( ts );
> }

The getCurrent routine needs to take a pointer to an epicsTimeStamp object, 
and it returns ERROR = -1 or OK = 0.  Try this:

int clockGetCurrent (epicsTimeStamp *pDest) {
    struct timespec ts;

    if (clock_gettime (CLOCK_REALTIME, &ts))
        return -1;

    *pDest = epicsTime (ts);
    return 0;
}

> 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?

For R3.14.8 I think you should be able to put that statement directly in your 
startup script; replace the NULL with 0 though, and make sure you call it 
before any EPICS code runs that asks for the current time since that will 
cause the built-in routines to get registered instead.  It's possible that 
you might have to drop the ampersand & character, but try it with first.

HTH,

- Andrew
-- 
Talk is cheap. Show me the code. -- Linus Torvalds

Replies:
Re: IOC to use time from its own processor Dehong Zhang
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

Navigate by Date:
Prev: Re: IOC to use time from its own processor Dehong Zhang
Next: Re: IOC to use time from its own processor Dehong Zhang
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: IOC to use time from its own processor Dehong Zhang
Next: Re: IOC to use time from its own processor Dehong Zhang
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·