Commit c4e76bd4 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Select: set default time of enddate to 23:59:59

parent 79c73966
......@@ -3,6 +3,10 @@
* using CDI library version 1.7.0
* Version 1.7.0 released
2015-09-06 Uwe Schulzweida
* Select: set default time of enddate to 23:59:59
2015-08-22 Uwe Schulzweida
* src/Makefile.am: removed -lstd++ (bug fix)
......
......@@ -29,7 +29,7 @@
#include "util.h"
//#include "list.h"
double datestr_to_double(const char *datestr);
double datestr_to_double(const char *datestr, int opt);
#define PML_INT 1
#define PML_FLT 2
......@@ -873,8 +873,8 @@ void *Select(void *argument)
startdate = par_startdate[0];
enddate = par_enddate[0];
if ( npar_startdate ) fstartdate = datestr_to_double(startdate);
if ( npar_enddate ) fenddate = datestr_to_double(enddate);
if ( npar_startdate ) fstartdate = datestr_to_double(startdate, 0);
if ( npar_enddate ) fenddate = datestr_to_double(enddate, 1);
}
else
{
......@@ -1036,7 +1036,8 @@ void *Select(void *argument)
PAR_CHECK_INT_FLAG(hour);
PAR_CHECK_INT_FLAG(minute);
PAR_CHECK_WORD_FLAG(startdate);
PAR_CHECK_WORD_FLAG(enddate);
UNUSED(str_enddate);
// PAR_CHECK_WORD_FLAG(enddate);
PAR_CHECK_WORD_FLAG(date);
if ( streamID2 != CDI_UNDEFID ) streamClose(streamID2);
......
......@@ -114,11 +114,13 @@ int seaslist(LIST *ilist)
}
double datestr_to_double(const char *datestr)
double datestr_to_double(const char *datestr, int opt)
{
int year = 1, month = 1, day = 1, hour = 0, minute = 0, second = 0;
double fval = 0;
if ( opt ) {hour = 23; minute = 59; second = 59;}
if ( strchr(datestr, '-') == NULL )
{
fval = parameter2double(datestr);
......@@ -133,7 +135,9 @@ double datestr_to_double(const char *datestr)
else
{
sscanf(datestr, "%d-%d-%d", &year, &month, &day);
fval = cdiEncodeDate(year, month, day);
fval = cdiEncodeTime(hour, minute, second);
if ( fabs(fval) > 0 ) fval /= 1000000;
fval += cdiEncodeDate(year, month, day);
}
return fval;
......@@ -162,7 +166,7 @@ int datelist(LIST *flist)
}
else
{
fval = datestr_to_double(operatorArgv()[i]);
fval = datestr_to_double(operatorArgv()[i], 0);
if ( strchr(operatorArgv()[i], 'T') )
set2 = FALSE;
else if ( nsel > 1 && i > 0 )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment