gotthard server and slsDetectorSoftware: more accuracy when converting from double to int64_t by adding 0.5, improved clock precision of gotthard from 32.1 to 32.007729

This commit is contained in:
2018-07-26 13:46:41 +02:00
parent 711e0d771e
commit 6213b5e07a
6 changed files with 30 additions and 62 deletions

View File

@ -5671,11 +5671,8 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
if (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME ||
index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER ||
index == SUBFRAME_PERIOD) {
// t=(int64_t)(val*1E+9); for precision of eg.0.0000325, following done
val*=1E9;
t = (int64_t)val;
if(fabs(val-t)) // to validate precision loss
t = t + val - t; //even t += vak-t loses precision
// +0.5 for precision of eg.0.0000325
t = ( val * 1E9 + 0.5);
}else t=(int64_t)val;
}