Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
be334bf7
Commit
be334bf7
authored
Oct 31, 2014
by
Uwe Schulzweida
Browse files
gribapiGetValidityDateTime: recalculate date only if day > 0
parent
94f1dd9d
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/stream_cgribex.c
View file @
be334bf7
...
...
@@ -142,7 +142,7 @@ int cgribexGetTsteptype(int timerange)
default:
if
(
lprint
)
{
Message
(
"
GRIB t
ime range %d unsupported!"
,
timerange
);
Message
(
"
T
ime range
indicator
%d unsupported
, set to 0
!"
,
timerange
);
lprint
=
FALSE
;
}
break
;
...
...
src/stream_gribapi.c
View file @
be334bf7
...
...
@@ -256,7 +256,7 @@ int gribapiGetTsteptype(grib_handle *gh)
else
if
(
strncmp
(
"ratio"
,
stepType
,
len
)
==
0
)
tsteptype
=
TSTEP_RATIO
;
else
if
(
lprint
)
{
Message
(
"stepType %s unsupported, set to instant!"
,
stepType
);
Message
(
"
Time
stepType %s unsupported, set to instant!"
,
stepType
);
lprint
=
FALSE
;
}
...
...
@@ -340,30 +340,33 @@ int gribapiGetValidityDateTime(grib_handle *gh, int *vdate, int *vtime)
cdiDecodeDate
(
rdate
,
&
ryear
,
&
rmonth
,
&
rday
);
cdiDecodeTime
(
rtime
,
&
rhour
,
&
rminute
,
&
rsecond
);
encode_caldaysec
(
grib_calendar
,
ryear
,
rmonth
,
rday
,
rhour
,
rminute
,
rsecond
,
&
julday
,
&
secofday
);
if
(
rday
>
0
)
{
encode_caldaysec
(
grib_calendar
,
ryear
,
rmonth
,
rday
,
rhour
,
rminute
,
rsecond
,
&
julday
,
&
secofday
);
addsec
=
0
;
switch
(
timeUnits
)
{
case
TUNIT_SECOND
:
addsec
=
time_period
;
break
;
case
TUNIT_MINUTE
:
addsec
=
60
*
time_period
;
break
;
case
TUNIT_HOUR
:
addsec
=
3600
*
time_period
;
break
;
case
TUNIT_3HOURS
:
addsec
=
10800
*
time_period
;
break
;
case
TUNIT_6HOURS
:
addsec
=
21600
*
time_period
;
break
;
case
TUNIT_12HOURS
:
addsec
=
43200
*
time_period
;
break
;
case
TUNIT_DAY
:
addsec
=
86400
*
time_period
;
break
;
default:
if
(
lprint
)
{
Warning
(
"Time unit %d unsupported"
,
timeUnits
);
lprint
=
FALSE
;
}
break
;
}
addsec
=
0
;
switch
(
timeUnits
)
{
case
TUNIT_SECOND
:
addsec
=
time_period
;
break
;
case
TUNIT_MINUTE
:
addsec
=
60
*
time_period
;
break
;
case
TUNIT_HOUR
:
addsec
=
3600
*
time_period
;
break
;
case
TUNIT_3HOURS
:
addsec
=
10800
*
time_period
;
break
;
case
TUNIT_6HOURS
:
addsec
=
21600
*
time_period
;
break
;
case
TUNIT_12HOURS
:
addsec
=
43200
*
time_period
;
break
;
case
TUNIT_DAY
:
addsec
=
86400
*
time_period
;
break
;
default:
if
(
lprint
)
{
Warning
(
"Time unit %d unsupported"
,
timeUnits
);
lprint
=
FALSE
;
}
break
;
}
julday_add_seconds
(
addsec
,
&
julday
,
&
secofday
);
julday_add_seconds
(
addsec
,
&
julday
,
&
secofday
);
decode_caldaysec
(
grib_calendar
,
julday
,
secofday
,
&
ryear
,
&
rmonth
,
&
rday
,
&
rhour
,
&
rminute
,
&
rsecond
);
decode_caldaysec
(
grib_calendar
,
julday
,
secofday
,
&
ryear
,
&
rmonth
,
&
rday
,
&
rhour
,
&
rminute
,
&
rsecond
);
}
*
vdate
=
cdiEncodeDate
(
ryear
,
rmonth
,
rday
);
*
vtime
=
cdiEncodeTime
(
rhour
,
rminute
,
rsecond
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment