Hello everyone,
Since the field .TIME is internal to a record (e.g. recordA), it seems not straightforward for a string record (e.g. recordB) to directly get the timestamp of recordA as a human-readable string, although
it is straightforward for a Python program to put a record’s timestamp as a string.
I managed to use “Soft Timestamp” together with “TSEL” to get the timestamp of a not-on-the-same-IOC record as a human-readable string. See below:
record(calcout,"recordA -Calc_") {
field(INPA,"recordA CP")
field(CALC,"1")
field(OOPT,"Transition To Zero")
field(OUT, "recordB.PROC")
}
record(stringin, "recordB")
{
field(DTYP,"Soft Timestamp")
field(PINI,"YES")
#without TSEL, recordB will not be exactly the same as recordA’s timestamp
field(TSEL,"recordA.TIME")
field(INP, "@%Y-%m-%d %H:%M:%S.%f")
info(autosaveFields_pass0, "VAL")
}
recordA is a bi record running on another IOC (that is why I use CP in INPA). I want to use recordB to latch the timestamp of recordA when recordA’s value goes from 1 to 0. Everything seems working as expected.
However, there is one problem with autosave. After the IOC is rebooted, the value of recordB is <undefined>, it is not restored to its saved value although I see the saved value “2020-08-15 01:18:55.236900451” in the *_pass0.sav file before I reboot the IOC.
I also tried to use pass1, the same result <undefined>.
$ caget -a recordB
recordB <undefined> <undefined>
I see some errors during the rebooting. I guess the reason why I get “dbGetTimeStamp failed” is that the CA link is not established yet before initial process (PINI=YES). However, when I look through the
code
https://github.com/epics-base/epics-base/blob/3.15/src/ioc/misc/iocInit.c, dbCaLinkInit() is indeed before initialProcess().
reboot_restore: entry for file 'settings_pass0.sav'
reboot_restore: Found filename 'settings_pass0.sav' in restoreFileList.
*** restoring from './as/save/settings_pass0.sav' at initHookState 6 (before record/device init) ***
reboot_restore: done with file 'settings_pass0.sav'
recGblGetTimeStamp: dbGetTimeStamp failed, recordB.TSEL = recordA
How do I solve this problem? Any suggestions are appreciated!
I am using Base-3.15.6-2 and autosave-5.9 if versions matter.
Thanks,
Yong Hu