|
|
Experimental Physics and
| ||||||||||||||||
|
|
# put 'Tick' to clock to start everything off
record(bo, "$(user):clock") {
field(ZNAM, "Tock")
field(ONAM, "Tick")
field(HIGH, "5")
field(FLNK, "$(user):timeNow")
}
# timeNow reports the timestamp from clock
record(stringin, "$(user):timeNow") {
field(TSEL, "$(user):clock.TIME")
field(DTYP, "Soft Timestamp")
field(INP, "@%Y-%m-%d %H:%M:%S.%09f")
field(FLNK, "$(user):drWho")
}
# drWho is 10 seconds behind the rest of us
record(sub, "$(user):drWho") {
field(TSE, "-2")
field(SNAM, "timeTravel")
field(INPA, "-10")
field(FLNK, "$(user):tardis")
}
# tardis reports where the doctor is
record(stringin, "$(user):tardis") {
field(TSEL, "$(user):drWho.TIME")
field(DTYP, "Soft Timestamp")
field(INP, "@%Y-%m-%d %H:%M:%S.%09f")
}I put this into the dbSubExample.c file: static long timeTravel(subRecord *precord)
{
epicsTimeGetCurrent(&precord->time);
epicsTimeAddSeconds(&precord->time, precord->a);
return 0;
}
epicsRegisterFunction(timeTravel);And this in the dbSubExample.dbd file: function(timeTravel) This is the result: cau: put anjHost:clock Tick
anjHost:timeNow 14:39:35.021182600 2006-09-06 14:39:35.021182600
anjHost:tardis 14:39:25.021356680 2006-09-06 14:39:25.021356680
anjHost:timeNow 14:39:40.025729720 2006-09-06 14:39:40.025729720
anjHost:tardis 14:39:30.025885560 2006-09-06 14:39:30.025885560Hmm, I wonder what some of the EPICS client tools would do if they see the doctor travelling backwards in time (i.e. get an earler timestamp from him *after* receiving a later one)... - Andrew -- There is considerable overlap between the intelligence of the smartest bears and the dumbest tourists -- Yosemite National Park Ranger
| ||||||||||||||||
| ANJ, 02 Sep 2010 |
·
Home
·
News
·
About
·
Talk
·
Base
·
Modules
·
Extensions
·
· Distributions · Download · Documents · Links · Licensing · |