diff -r 000000000000 -r 50cbed80af1a IOCstatsApp/devTimestampWorkaround.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IOCstatsApp/devTimestampWorkaround.c Wed Jun 05 14:34:28 2013 +0200 @@ -0,0 +1,53 @@ +/* + * Stringin device support for EPICS time stamps + * + * devTimestampSI.c,v 1.1.2.1 2004/01/08 21:08:56 norume Exp + * + * fixed for vxWorks 5.4.2 bfr + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static long +read_stringin (struct stringinRecord *psi) +{ + int l; + + recGblGetTimeStamp(psi); + if (strcmp(psi->inp.value.instio.string,"%s")==0) { + l = epicsSnprintf(psi->val, sizeof psi->val, "%u", psi->time.secPastEpoch); + } else { + l = epicsTimeToStrftime(psi->val, sizeof psi->val, psi->inp.value.instio.string, &psi->time); + } + if (l >= sizeof psi->val) { + psi->udf = 1; + recGblSetSevr(psi,UDF_ALARM,INVALID_ALARM); + return -1; + } + psi->udf = 0; + return 0; +} + +struct { + long number; + DEVSUPFUN dev_report; + DEVSUPFUN init; + DEVSUPFUN init_record; /*returns: (0,2)=>(success,success no convert)*/ + DEVSUPFUN get_ioint_info; + DEVSUPFUN read_stringin;/*(0)=>(success ) */ +} devSiTimestampWorkaround = { + 6, + NULL, + NULL, + NULL, + NULL, + read_stringin +}; +epicsExportAddress(dset,devSiTimestampWorkaround);