Commit 9ea3e3d9 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

decode_timevalue: bug fix for rounding error

parent fbc2792f
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
for Int, Flt and Txt for Int, Flt and Txt
* Add support for Lambert grids [request: Patrick Samuelsson] * Add support for Lambert grids [request: Patrick Samuelsson]
* Change cdiDefCompress to streamDefZtype/streamDefZlevel * Change cdiDefCompress to streamDefZtype/streamDefZlevel
* decode_timevalue: bug fix for rounding error [report: Veronika Gayler]
* Version 1.1.0 released * Version 1.1.0 released
2007-10-22 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de> 2007-10-22 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
......
...@@ -847,7 +847,7 @@ void decode_timevalue(int timeunit, double timevalue, int *days, int *secs) ...@@ -847,7 +847,7 @@ void decode_timevalue(int timeunit, double timevalue, int *days, int *secs)
else if ( timeunit == TUNIT_DAY ) else if ( timeunit == TUNIT_DAY )
{ {
*days = (int) timevalue; *days = (int) timevalue;
*secs = (int) ((timevalue - *days)*86400); *secs = (int) ((timevalue - *days)*86400 + 0.5);
if ( *secs < 0 ) { *days -= 1; *secs += 86400; }; if ( *secs < 0 ) { *days -= 1; *secs += 86400; };
/* /*
{ {
......
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