Skip to content
GitLab
Menu
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
bae85738
Commit
bae85738
authored
Aug 12, 2015
by
Uwe Schulzweida
Browse files
absolute time axis with time units month: fix rounding error for negativ years
parent
d9c25a49
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/taxis.c
View file @
bae85738
...
...
@@ -1201,7 +1201,9 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
else
if
(
timeunit
==
TUNIT_MONTH
)
{
vdate
=
(
int
)
timevalue
*
100
;
vdate
+=
1
;
if
(
vdate
<
0
)
vdate
-=
1
;
else
vdate
+=
1
;
vtime
=
0
;
}
else
if
(
timeunit
==
TUNIT_YEAR
)
...
...
@@ -1346,11 +1348,13 @@ double cdiEncodeTimeval(int date, int time, taxis_t *taxis)
{
int
year
,
month
,
day
;
cdiDecodeDate
(
date
,
&
year
,
&
month
,
&
day
);
if
(
day
==
0
)
timevalue
=
date
/
100
;
else
timevalue
=
date
/
100
+
0
.
5
;
}
timevalue
=
date
/
100
;
if
(
day
!=
0
)
{
if
(
date
<
0
)
timevalue
-=
0
.
5
;
else
timevalue
+=
0
.
5
;
}
}
else
{
int
hour
,
minute
,
second
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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