![]() |
![]() ![]()
Experimental Physics and
| ||||||||||||||||
|
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") }
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
| ||||||||||||||||
ANJ, 02 Sep 2010 |
![]() · Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |