EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Re: Device with INP as a PV_LINK
From: Eric Norum <[email protected]>
To: epics <[email protected]>
Date: Wed, 6 Sep 2006 13:13:33 -0500
To avoid leading spaces on the fractional part you need to provide a '0' between the '%' and the width digit.  For example,
  field(INP, "@%Y-%m-%d %H:%M:%S.%09f")        
or
  field(INP, "@%Y-%m-%d %H:%M:%S.%03f")    


On Sep 6, 2006, at 9:31 AM, Andrew Johnson wrote:

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.


-- 
Eric Norum <[email protected]>
Advanced Photon Source
Argonne National Laboratory
(630) 252-4793



Replies:
Re: Device with INP as a PV_LINK Andrew Johnson
References:
Device with INP as a PV_LINK Emmanuel Mayssat
Re: Device with INP as a PV_LINK Tim Mooney
Re: Device with INP as a PV_LINK Andrew Johnson

Navigate by Date:
Prev: Re: A question concerning rset->special() Andrew Johnson
Next: Re: Device with INP as a PV_LINK Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  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 Andrew Johnson
Next: Re: Device with INP as a PV_LINK Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  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 ·