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

scan netcdf time units attribute (bug fix)

parent 71206bca
......@@ -2,6 +2,10 @@
* Version 1.6.8 released
2015-02-12 Uwe Schulzweida
* scan netcdf time units attribute (bug fix)
2015-02-02 Uwe Schulzweida
* gribapiDefDateTimeRel: forecastTime [Bug #5435]
......
......@@ -208,20 +208,29 @@ int isTimeAxisUnits(const char *timeunits)
static
void scanTimeString(const char *ptu, int *rdate, int *rtime)
{
int year, month, day;
int year = 1, month = 1, day = 1;
int hour = 0, minute = 0, second = 0;
int v1, v2, v3;
int v1 = 1, v2 = 1, v3 = 1;
*rdate = 0;
*rtime = 0;
v1 = atoi(ptu);
if ( v1 < 0 ) ptu++;
while ( isdigit((int) *ptu) ) ptu++;
v2 = atoi(++ptu);
while ( isdigit((int) *ptu) ) ptu++;
v3 = atoi(++ptu);
while ( isdigit((int) *ptu) ) ptu++;
if ( *ptu )
{
v1 = atoi(ptu);
if ( v1 < 0 ) ptu++;
while ( isdigit((int) *ptu) ) ptu++;
if ( *ptu )
{
v2 = atoi(++ptu);
while ( isdigit((int) *ptu) ) ptu++;
if ( *ptu )
{
v3 = atoi(++ptu);
while ( isdigit((int) *ptu) ) ptu++;
}
}
}
if ( v3 > 999 && v1 < 32 )
{ year = v3; month = v2; day = v1; }
......
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