Make epicsTS carry the proper EVR timestamp

epicsTS is the one passed to kafka: https://gitlab.esss.lu.se/epics-modules/ADPluginKafka/-/blob/2.0.2/adpluginkafkaApp/src/KafkaPlugin.cpp?ref_type=tags#L40
The documentation is a bit confusing on what is the difference between
epicsTS and timeStamp, but apparently both can be modified with no
problems.

After [this discussion](github.com/areaDetector/ADCore/issues?q=is%3Aissue%20state%3Aclosed)
I decided it was fine to keep the epicsTS in nanoseconds with the EVR
values.
This commit is contained in:
marcofilho
2026-10-11 17:46:44 +02:00
parent e2d6d48cde
commit cceb18989b
2 changed files with 9 additions and 8 deletions

View File

@@ -834,6 +834,7 @@ void Orca::imageTask() {
uint64_t prevAcquisitionCount = 0;
DCAMCAP_TRANSFERINFO captransferinfo;
epicsTimeStamp prevAcqTime, currentAcqTime;
epicsTimeStamp acqTimestamp;
epicsTimeStamp prev_trigger_time, current_trigger_time;
double elapsedTime;
int evr_counts = 0;
@@ -929,14 +930,17 @@ void Orca::imageTask() {
setIntegerParam(evrTriggerDropped, evr_trigger_dropped);
// remember parsed timestamp values
sscanf(buf, "%u.%u", &mTimeStampSec, &mTimeStampNsec);
timestamp = mTimeStampSec + mTimeStampNsec / 1.e9;
FLOW_ARGS("mTimeStampSec: %u - mTimeStampNsec: %u\n", mTimeStampSec,
mTimeStampNsec);
sscanf(buf, "%u.%u", &acqTimestamp.secPastEpoch, &acqTimestamp.nsec);
acqTimestamp.secPastEpoch -= POSIX_TIME_AT_EPICS_EPOCH;
timestamp = acqTimestamp.secPastEpoch + acqTimestamp.nsec / 1.e9;
FLOW_ARGS("acqTimestamp.secPastEpoch: %u - acqTimestamp.nsec: %u\n", acqTimestamp.secPastEpoch,
acqTimestamp.nsec);
FLOW_ARGS("Timestamp from evr: %f\n", timestamp);
} else {
updateTimeStamp(&acqTimestamp);
timestamp =
(ts_sec + ts_microsec / 1.0e6) - (exposure_time + readout_time);
FLOW_ARGS("Timestamp from camera: %f\n", timestamp);
@@ -966,7 +970,7 @@ void Orca::imageTask() {
if (pImage) {
pImage->uniqueId = count;
pImage->timeStamp = timestamp;
updateTimeStamp(&pImage->epicsTS);
pImage->epicsTS = acqTimestamp;
memcpy(pImage->pData, (epicsUInt16*)image, pImage->dataSize);

View File

@@ -189,9 +189,6 @@ class epicsShareClass Orca : public ADDriver {
int readParameter(int propertyID, bool processPV = true);
int readParameterStr(int paramIndex);
epicsUInt32 mTimeStampSec;
epicsUInt32 mTimeStampNsec;
void imageTask();
void temperatureTask();