Someone else asked for this feature. I think the first person to ask was Timo
Korhonen (SLS) who is also the person who is redoing drvTS, which is the support
for hardware generated time stamps.
The next version of base (both 3.13 and 3.14) will provide this feature. The
exact method is still undecided. Corrently in my working area I have the
following change to recGbl.c
For 3.13
void recGblGetTimeStamp(void* prec)
{
struct dbCommon* pr = (struct dbCommon*)prec;
if(pr->tsel.type!=CONSTANT)
dbGetLink(&(pr->tsel), DBR_SHORT,&(pr->tse),0,0);
if(pr->tse!=-1)
TSgetTimeStamp((int)pr->tse,(struct timespec*)&pr->time);
}
For 3.14 I have
void epicsShareAPI recGblGetTimeStamp(void* prec)
{
struct dbCommon* pr = (struct dbCommon*)prec;
int status = 0;
if(pr->tsel.type!=CONSTANT)
dbGetLink(&(pr->tsel), DBR_SHORT,&(pr->tse),0,0);
if (pr->tse!=-1)
status = epicsTimeGetEvent(&pr->time,(unsigned)pr->tse);
if(status) errlogPrintf("%s recGblGetTimeStamp failed\n",pr->name);
}
The above change says that if TSE=-1 then dont do anyting to the time stamp.
This is NOT the final answer however. David Thompson (SNS) pointed out that the
existing drvTS already treats TSE=-1 as a special case. It means that drvTS
should get the most accurate current time stamp. For example with the APS
hardware time stamp support, we keep a 1 millisecond hardware generated clock.
If TSE=-1 then the time stamp will be taken from this clock rather than the
vxWorks 60 HZ clock.
Thus the above change to recGblGetTimeStamp is not correct. David suggested that
we define.
#define epicsTimeEventBestTime -1
#define epicsTimeEventDeviceTime -10000
epicsTimeEventBestTime would be used by drvTS and it's successor.
epicsTimeEventDeviceTime says that device support is supplying the time stamp so
recGblGetTimeStamp should not do anything.
Questions to be resolved
1) Where do we define these? For 3.14 the obvious place is epicsTime.h. For 3.13
it is probably tsDefs.h
2) What value should we use for epicsTimeEventDeviceTime?
3) Whoever set the value for TSE must know about these values. How do we make
these values known? Just document them in the Application Developer's Guide?
Noboru Yamamoto wrote:
> Hi,
>
> [Question]
>
> Is there any good way to set a timestamp of a record while a
> process() function of a device support routine is called?
>
> [Why I'm asking this question]
>
> We need to import live data from the facility control
> system, which uses a proprietary control system. This system
> update the information on the memory periodically with
> theire own timestamp. We would like to use
> this timestamp as a timestamp of EPICS records rather than
> the timestamp when the record is updated.
>
> Looking at aiRecord.c, for example, recGblGetTimeStamp is
> called AFTER a call to read() function in a device support
> is finished.
>
> Any idea?
>
> Noboru
>
>
- Replies:
- Re: [Q] How to set a timestamp in a device support routine. Carl Lionberger
- References:
- [Q] How to set a timestamp in a device support routine. Noboru Yamamoto
- Navigate by Date:
- Prev:
[Report] EPICS R3.13.6 build on RH Linux7.3 Noboru Yamamoto
- Next:
Re: [Q] How to set a timestamp in a device support routine. Carl Lionberger
- 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:
[Q] How to set a timestamp in a device support routine. Noboru Yamamoto
- Next:
Re: [Q] How to set a timestamp in a device support routine. Carl Lionberger
- 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
|