Commit 6a20d938 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

No commit message

No commit message
parent 48448174
......@@ -1184,13 +1184,14 @@ void streamClose(int streamID)
stream_delete_entry(streamptr);
if ( vlistInqTaxis(vlistID) != -1 )
{
taxisDestroy(vlistInqTaxis(vlistID));
}
if ( vlistID != -1 )
{
if ( streamptr->filemode != 'w' )
if ( vlistInqTaxis(vlistID) != -1 )
{
taxisDestroy(vlistInqTaxis(vlistID));
}
vlistDestroy(vlistID);
}
}
......
......@@ -1033,6 +1033,7 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
static char func[] = "splitTimevalue";
int vdate = 0, vtime = 0;
int hour, minute;
int year, month, day;
if ( timeunit == TUNIT_HOUR )
{
......@@ -1069,6 +1070,26 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
Message(func, "Unsupported TIMEUNIT: %s!", tunitNamePtr(timeunit));
}
/* verify date and time */
decode_date(vdate, &year, &month, &day);
decode_time(vtime, &hour, &minute);
if ( month > 17 || day > 31 || hour > 23 || minute > 59 )
{
if ( (month > 17 || day > 31) && (year < -9999 || year > 9999) ) year = 1;
if ( month > 17 ) month = 1;
if ( day > 31 ) day = 1;
if ( hour > 23 ) hour = 0;
if ( minute > 59 ) minute = 0;
vdate = encode_date(year, month, day);
vtime = encode_time(hour, minute);
Warning(func, "Reset wrong date/time to %4.4d-%2.2d-%2.2d %2.2d:%2.2d!",
year, month, day, hour, minute);
}
*date = vdate;
*time = vtime;
}
......
Markdown is supported
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