diff --git a/src/drv/fmReadCoeff.c b/src/drv/fmReadCoeff.c index 49363818fa045ecc978163ce3caf485e8dfd9067..9eed5d13141544c694c0afb08bef1005fc63c5a1 100644 --- a/src/drv/fmReadCoeff.c +++ b/src/drv/fmReadCoeff.c @@ -120,7 +120,7 @@ void memcpy_swap_words(void *dest, void *src) { #endif /// Read system 'fmc' coeffs for subsys 'n' -int fmReadCoeffFile(fmReadCoeff *fmc, int n) { +int fmReadCoeffFile(fmReadCoeff *fmc, int n, unsigned long gps) { int i, j, k; int ix; @@ -204,13 +204,18 @@ int fmReadCoeffFile(fmReadCoeff *fmc, int n) { char buf[128]; unsigned long t = 0; - // See if we have /proc/gps time and read the GPS time from it - FILE *f = fopen("/proc/gps", "r"); - if (f) { - if (fgets(buf, 128, f)) { - t = atol(buf); + // If GPS time is supplied by the front-end, use that + if (gps > 0) { + t = gps; + } else { + // See if we have /proc/gps time and read the GPS time from it + FILE *f = fopen("/proc/gps", "r"); + if (f) { + if (fgets(buf, 128, f)) { + t = atol(buf); + } + close(f); } - close(f); } // Failed to get the time from /proc/gps, so use system time diff --git a/src/epics/util/skeleton.st b/src/epics/util/skeleton.st index 1a7c169a39162e5df1897365a42a85cd5720f702..3efa0bf9bc10c21ee90ff6a651af5806f5836368 100644 --- a/src/epics/util/skeleton.st +++ b/src/epics/util/skeleton.st @@ -389,7 +389,7 @@ state init strcpy(msg, "Reading coeff file..."); pvPut(msg); -%% if (fmReadCoeffFile(&fmc, 0) != 0) { +%% if (fmReadCoeffFile(&fmc, 0, pEpics->epicsOutput.timeDiag) != 0) { %% fprintf(stderr, "Error: %s\n", fmReadErrMsg()); strncpy(msg, fmReadShortErrMsg(), MAX_STRING_SIZE-1); %% } else { @@ -538,7 +538,7 @@ state monScreen{ pvPut(msg); %% /* printf("About to read file \n"); */ -%% if (fmReadCoeffFile(&fmc, 0) != 0) { +%% if (fmReadCoeffFile(&fmc, 0, pEpics->epicsOutput.timeDiag) != 0) { %% fprintf(stderr, "Error: %s\n", fmReadErrMsg()); strncpy(msg, fmReadShortErrMsg(), MAX_STRING_SIZE-1); pvPut(msg); @@ -979,7 +979,7 @@ state filtCoefChk %% /* printf("About to read file \n"); */ -%% if (fmReadCoeffFile(&fmc, 0) != 0) { +%% if (fmReadCoeffFile(&fmc, 0, pEpics->epicsOutput.timeDiag) != 0) { %% fprintf(stderr, "Error: %s\n", fmReadErrMsg()); strncpy(msg, fmReadShortErrMsg(), MAX_STRING_SIZE-1); pvPut(msg); diff --git a/src/include/fmReadCoeff.h b/src/include/fmReadCoeff.h index f106052e956cdba92dbf0c88d64d6431c5d5e3b7..6f84c773f95aa071f18bb3343f4adbeaf4f4c5fd 100644 --- a/src/include/fmReadCoeff.h +++ b/src/include/fmReadCoeff.h @@ -49,7 +49,7 @@ typedef struct fmReadCoeff { #define TF_THRESHOLDS_NOT_FOUND 2 /* MA */ #define TF_PARSE_ERROR 3 /* MA */ -int fmReadCoeffFile(fmReadCoeff *, int); +int fmReadCoeffFile(fmReadCoeff *, int, unsigned long); char* fmReadErrMsg(); char* fmReadShortErrMsg();