|
|
Experimental Physics and
| ||||||||||||||||
|
|
Ralph Lange wrote:
Interesting question; I can't think of any _reasonable_ ways that don't involve writing some C code -- there is an unreasonable way to do it without coding, but it would be quite a sight to see! The simplest way is to use a subroutine record, the TSEL link of the record should point to the TIME field of the record whose timestamp you want to know. The subroutine code is just: void timeSubroutine(subRecord *prec) {
recGblGetTimeStamp(prec);
prec->val = prec->time.secPastEpoch;
}If you want the full nanosecond accuracy, or need to adjust the epoch you could use some variant of this code: void timeSubroutine(subRecord *prec) {
epicsTimeStamp epoch = {0, 0}; /* Jeff won't like this! */
recGblGetTimeStamp(prec);
prec->val = epicsTimeDiffInSeconds(&prec->time, &epoch);
}Of course you could also do this within an ai device support instead, but the subroutine record code can be used in as many record instances as you need. - Andrew -- The right to be heard does not automatically include the right to be taken seriously. -- Hubert H. Humphrey
| ||||||||||||||||
| ANJ, 10 Nov 2011 |
·
Home
·
News
·
About
·
Talk
·
Base
·
Modules
·
Extensions
·
· Distributions · Download · Documents · Links · Licensing · |