replace calls to tsDefs.h by calls to tsStamp
This commit is contained in:
+30
-7
@@ -56,6 +56,7 @@
|
||||
#endif
|
||||
|
||||
#include "cadef.h"
|
||||
#include "tsStamp.h"
|
||||
|
||||
int ca_test(char *pname, char *pvalue);
|
||||
LOCAL int cagft(char *pname);
|
||||
@@ -401,6 +402,28 @@ LOCAL void verify_value(chid chan_id, chtype type)
|
||||
*
|
||||
* switches over the range of CA data types and reports the value
|
||||
*/
|
||||
|
||||
LOCAL void tsStampToText(char * text, const TS_STAMP *pstamp)
|
||||
{
|
||||
struct tm tmstruct;
|
||||
unsigned long nsec;
|
||||
char nsectext[14];
|
||||
int status;
|
||||
|
||||
|
||||
status = tsStampToTM(&tmstruct,&nsec,pstamp);
|
||||
if(status) {
|
||||
sprintf(text,"illegal time stamp\0");
|
||||
return;
|
||||
}
|
||||
sprintf(nsectext,".%09ul",nsec);
|
||||
if((nsec%1000000)*1000000 == nsec) nsectext[4] = 0;
|
||||
else if((nsec%1000)*1000 == nsec) nsectext[7] = 0;
|
||||
else nsectext[10] = 0;
|
||||
strftime(text,40,"%m/%d/%Y %H:%M:%S",&tmstruct);
|
||||
strcat(text,nsectext);
|
||||
}
|
||||
|
||||
LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count)
|
||||
{
|
||||
unsigned i;
|
||||
@@ -568,7 +591,7 @@ LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count)
|
||||
struct dbr_time_string *pvalue
|
||||
= (struct dbr_time_string *) pbuffer;
|
||||
|
||||
tsStampToText(&pvalue->stamp,TS_TEXT_MMDDYY,tsString);
|
||||
tsStampToText(tsString, &pvalue->stamp);
|
||||
printf("%2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\tTimeStamp: %s",tsString);
|
||||
printf("\tValue: ");
|
||||
@@ -581,7 +604,7 @@ LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count)
|
||||
= (struct dbr_time_enum *)pbuffer;
|
||||
dbr_enum_t *pshort = &pvalue->value;
|
||||
|
||||
tsStampToText(&pvalue->stamp,TS_TEXT_MMDDYY,tsString);
|
||||
tsStampToText(tsString,&pvalue->stamp);
|
||||
printf("%2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\tTimeStamp: %s",tsString);
|
||||
if(count==1) printf("\tValue: ");
|
||||
@@ -597,7 +620,7 @@ LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count)
|
||||
= (struct dbr_time_short *)pbuffer;
|
||||
dbr_short_t *pshort = &pvalue->value;
|
||||
|
||||
tsStampToText(&pvalue->stamp,TS_TEXT_MMDDYY,tsString);
|
||||
tsStampToText(tsString, &pvalue->stamp);
|
||||
printf("%2d %2d",
|
||||
pvalue->status,
|
||||
pvalue->severity);
|
||||
@@ -615,7 +638,7 @@ LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count)
|
||||
= (struct dbr_time_float *)pbuffer;
|
||||
dbr_float_t *pfloat = &pvalue->value;
|
||||
|
||||
tsStampToText(&pvalue->stamp,TS_TEXT_MMDDYY,tsString);
|
||||
tsStampToText(tsString, &pvalue->stamp);
|
||||
printf("%2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\tTimeStamp: %s",tsString);
|
||||
if(count==1) printf("\tValue: ");
|
||||
@@ -631,7 +654,7 @@ LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count)
|
||||
= (struct dbr_time_char *)pbuffer;
|
||||
dbr_char_t *pchar = &pvalue->value;
|
||||
|
||||
tsStampToText(&pvalue->stamp,TS_TEXT_MMDDYY,tsString);
|
||||
tsStampToText(tsString, &pvalue->stamp);
|
||||
printf("%2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\tTimeStamp: %s",tsString);
|
||||
if(count==1) printf("\tValue: ");
|
||||
@@ -647,7 +670,7 @@ LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count)
|
||||
= (struct dbr_time_long *)pbuffer;
|
||||
dbr_long_t *plong = &pvalue->value;
|
||||
|
||||
tsStampToText(&pvalue->stamp,TS_TEXT_MMDDYY,tsString);
|
||||
tsStampToText(tsString, &pvalue->stamp);
|
||||
printf("%2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\tTimeStamp: %s",tsString);
|
||||
if(count==1) printf("\tValue: ");
|
||||
@@ -663,7 +686,7 @@ LOCAL void print_returned(chtype type, const void *pbuffer, unsigned count)
|
||||
= (struct dbr_time_double *)pbuffer;
|
||||
dbr_double_t *pdouble = &pvalue->value;
|
||||
|
||||
tsStampToText(&pvalue->stamp,TS_TEXT_MMDDYY,tsString);
|
||||
tsStampToText(tsString, &pvalue->stamp);
|
||||
printf("%2d %2d",pvalue->status,pvalue->severity);
|
||||
printf("\tTimeStamp: %s",tsString);
|
||||
if(count==1) printf("\tValue: ");
|
||||
|
||||
Reference in New Issue
Block a user