Commit 933b289f7ab5c965ad32207f2695e24651813d1d
1 parent
03d0ceed
Exists in
master
and in
1 other branch
Support for time in double format
Showing
3 changed files
with
30 additions
and
3 deletions
Show diff stats
src/DDClientLibC/DD_client.c
... | ... | @@ -536,10 +536,20 @@ int DD_SetTimeInfo(int VarID, char *Time, double *RealTime) |
536 | 536 | if (err < 1) return err; |
537 | 537 | |
538 | 538 | err = DD_GetData(VarID, "Time", TimeInt, &data); |
539 | + | |
539 | 540 | if (err < 0) return err; |
541 | + | |
540 | 542 | if (data->VarNumber < 1) return OUTOFTIME; |
541 | 543 | |
542 | - *RealTime = DD_Time2Double((char *)data->Variables[0]); | |
544 | + if (data->type == DD_CHAR) { | |
545 | + *RealTime = DD_Time2Double((char *)data->Variables[0]); | |
546 | + } | |
547 | + else if (data->type == DD_DOUBLE) { | |
548 | + *RealTime = *((double*)data->Variables[0]); | |
549 | + } | |
550 | + else { | |
551 | + return DATAFILEERR; | |
552 | + } | |
543 | 553 | |
544 | 554 | //BRE - When the corresponding time is the last one of a file, MOREDATA is returned by DDServer. |
545 | 555 | // => force recall of DD_GetData to open the next file and finish correctly the request | ... | ... |
src/DDClientLibC/INCLUDE/DD_comm.h
... | ... | @@ -302,6 +302,15 @@ extern int Cache_ReleaseDataFileAccess(DD_Var_t *D); |
302 | 302 | extern int Cache_CloseFile(DD_Var_t *D); |
303 | 303 | |
304 | 304 | /* |
305 | + * | |
306 | + */ | |
307 | +extern int Time_GetVarID(int ncID); | |
308 | + | |
309 | +extern int Time_IsDoubleVar(int ncID, int timeVarID); | |
310 | + | |
311 | +extern double Time_GetValueFromVar(int ncID, int timeVarID, int isDoubleTime, int recNum); | |
312 | + | |
313 | +/* | |
305 | 314 | * Open Virtual instrument by name and returns the ID |
306 | 315 | * Returns negative value in case of error (see DD.h)or OK |
307 | 316 | */ | ... | ... |
src/DDClientLibCpp/DD_client.cc
... | ... | @@ -244,7 +244,7 @@ int DD_Client::GetSocket() |
244 | 244 | #ifdef LOG4CXX |
245 | 245 | LOG4CXX_ERROR(_logger, "DD_Client::GetSocket - Connection to server socket error - " << strerror (errnum)); |
246 | 246 | #endif |
247 | - perror("connect"); | |
247 | + perror(strerror (errnum)); | |
248 | 248 | return(-1); |
249 | 249 | } |
250 | 250 | |
... | ... | @@ -672,7 +672,15 @@ int DD_Client:: DD_SetTimeInfo(int VarID, char *Time, double *RealTime) |
672 | 672 | return OUTOFTIME; |
673 | 673 | } |
674 | 674 | |
675 | - *RealTime = DD_Time2Double((char *)data->Variables[0]); | |
675 | + if (data->type == DD_CHAR) { | |
676 | + *RealTime = DD_Time2Double((char *)data->Variables[0]); | |
677 | + } | |
678 | + else if (data->type == DD_DOUBLE) { | |
679 | + *RealTime = *((double*)data->Variables[0]); | |
680 | + } | |
681 | + else { | |
682 | + return DATAFILEERR; | |
683 | + } | |
676 | 684 | |
677 | 685 | //BRE - When the corresponding time is the last one of a file, MOREDATA is returned by DDServer. |
678 | 686 | // => force recall of DD_GetData to open the next file and finish correctly the request | ... | ... |