Experimental Physics and Industrial Control System
Tim Mooney wrote:
By the way, you example problem is treated in Ned Arnold's devTimeOfDay.c.
I snuck a copy of this into the synApps std module, if you're interested.
These old timestamp conversion device supports are no longer needed, and
should be eliminated - since R3.14.5 there has been a soft stringin
device support included with Base called devTimestampSI.c whose INST_IO
parm string is a format string for epicsTimeToStrftime() which extends
the strftime() formatting to include fractional seconds.
The time value that this device support converts is the timestamp of the
stringin record itself, but by pointing its .TSEL field to another
record's .TIME field it can be made to convert arbitrary timestamps by
reading them from that other record. If the time you want to convert
isn't in any record's timestamp yet, you can make it one using a
subroutine record whose subroutine sets its own timestamp by converting
it from whatever format you do have (the sub record will need to have
its .TSE field set to -2 to stop it from being overwritten by the record
support afterwards).
Here are a couple of examples, untested.
# timeString gives the timestamp from timeMe
record(bi, "timeMe") {
field(SCAN, "I/O Intr")
field(FLNK, "timeString")
...
}
record(stringin, "timeString") {
field(TSEL, "timeMe.TIME")
field(DTYP, "Soft Timestamp")
field(INP, "@%Y-%m-%d %H:%M:%S.%9f")
}
# Offset timestamp
record(sub, "drWho") {
field(TSE, "-2")
field(SNAM, "timeTravel")
field(INPA, "10")
}
record(stringin, "timeString") {
field(TSEL, "delayedTime.TIME")
field(DTYP, "Soft Timestamp")
field(INP, "@%Y-%m-%d %H:%M:%S.%9f")
}
static long timeTravel(subRecord *precord)
{
epicsTimeGetCurrent(&precord->time);
epicsTimeAddSeconds(&precord->time, precord->a)
return 0;
}
If somebody wants to test the above and post any corrections this
message can act as an example to future questioners on the topic.
- Andrew
--
There is considerable overlap between the intelligence of the smartest
bears and the dumbest tourists -- Yosemite National Park Ranger
- Replies:
- Re: Device with INP as a PV_LINK Eric Norum
- References:
- Device with INP as a PV_LINK Emmanuel Mayssat
- Re: Device with INP as a PV_LINK Tim Mooney
- Navigate by Date:
- Prev:
Re: StripTool2_5_10_0 display of waveform records? Thomas Pelaia II
- Next:
Re: A question concerning rset->special() Andrew Johnson
- 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: Device with INP as a PV_LINK Tim Mooney
- Next:
Re: Device with INP as a PV_LINK Eric Norum
- 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