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  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  <20222023  2024  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  <20222023  2024 
<== Date ==> <== Thread ==>

Subject: Re: How to input TIME field values in aSub record types?
From: Andrew Johnson via Tech-talk <tech-talk at aps.anl.gov>
To: tech-talk at aps.anl.gov
Date: Mon, 15 Aug 2022 11:10:44 -0500
Hi Amin,

On 8/15/22 1:08 AM, Amin Hosseini Nejad via Tech-talk wrote:
I need to have an array of TIME field values of a PV as an input to an aSub record, but since the input type should be one of the data type listed on menuFtype, I do know how to do so, so I would appreciate it if anyone could direct me on that.
Are those timestamps being collected by EPICS, meaning that they represent seconds since the EPICS EPOCH? An epicsTimeStamp object is a pair of epicsUInt32 values holding the number of seconds and nanoseconds since 1990-01-01 00:00:00.0 UTC and can hold values up to the year 2106. How are you collecting/generating your array data, and what do you plan to do with the values inside the aSub record?

As an idea, I thought of getting the TIME field values as string and then, filling the array using circular buffer algorithm in a compress record, and then, imputing the array to the aSub record as a string array, and in the c++ subroutine, converting the TIME field values to epicsTime, but the challenge I am facing is that the TIME field value is of NTP format, and I do not know what format specifier, not listed in strftime function, I can use to expand the fractional part of the time, and I can just not ignore that part of the TIME value. I know I can set up my format specifier using  boost::date_time library and its time_facet in my c++ subroutine, but I still have the problem getting the fractional part using stringin record type described in below link:


https://epics.anl.gov/tech-talk/2016/msg01039.php


Thank you in advance and will be looking forward to hearing back from you soon.

Passing timestamp values around as and converting them to/from strings is not particularly efficient and could be a somewhat brittle solution (due to local timezone settings amongst other things), so I would avoid looking at that approach if you can avoid it.

Could your aSub record (or another aSub earlier in the chain) collect the individual timestamps from wherever they are coming from and store them into an array of UINT64 values which are actually just the pair of ULONG values from the timestamp? Using an aSub to collect them would allow your code to call dbGetTimeStamp() to fetch a timestamp from the record that an input link points to without having to use any special tricks like the stringin device support that you linked to.

If you can give us some more information about your specific problem we might be able to help more.

By the way, to get fractional seconds with an strftime format string in EPICS, you use a %f format specifier for the fraction, e.g. %Y-%m-%d %H:%M:%S.%06f or %Y-%m-%d %H:%M:%S.%09f depending whether you want microsecond or nanosecond precision.

- Andrew

-- 
Complexity comes for free, Simplicity you have to work for.

References:
How to input TIME field values in aSub record types? Amin Hosseini Nejad via Tech-talk

Navigate by Date:
Prev: Re: CSS spinner and text box instant write Kasemir, Kay via Tech-talk
Next: PVs in galil-3-6 Jong Woo Kim via Tech-talk
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  <20222023  2024 
Navigate by Thread:
Prev: How to input TIME field values in aSub record types? Amin Hosseini Nejad via Tech-talk
Next: PVs in galil-3-6 Jong Woo Kim via Tech-talk
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  <20222023  2024 
ANJ, 14 Sep 2022 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·