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
eaa89ea9
Commit
eaa89ea9
authored
Mar 12, 2010
by
Uwe Schulzweida
Browse files
timeval2vtime cleanup
parent
66613610
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/taxis.c
View file @
eaa89ea9
...
...
@@ -1034,22 +1034,37 @@ void timeval2vtime(double timevalue, TAXIS *taxis, int *vdate, int *vtime)
if
(
timeunit
==
TUNIT_MONTH
||
timeunit
==
TUNIT_YEAR
)
{
int
nmon
;
int
nmon
/*, nday */
;
/* double fmon; */
if
(
timeunit
==
TUNIT_YEAR
)
timevalue
*=
12
;
if
(
timeunit
==
TUNIT_YEAR
)
{
timeunit
=
TUNIT_MONTH
;
timevalue
*=
12
;
}
if
(
(
NINT
(
timevalue
*
10
))
%
10
&&
lwarn
)
{
Warning
(
func
,
"Possible wrong calculation of date/time!
\n
"
"Time offset
isn't
integer for time unit MONTH and YEAR!"
);
"Time offset
have to be
integer for time unit MONTH and YEAR!"
);
lwarn
=
FALSE
;
}
nmon
=
(
int
)
(
timevalue
+
0
.
001
);
/*
nmon = (int) timevalue;
fmon = timevalue - nmon;
printf("timevalue %g, nmon %d, fmon %g\n", timevalue, nmon, fmon);
*/
month
+=
nmon
;
while
(
month
>
12
)
{
month
-=
12
;
year
++
;
}
while
(
month
<
1
)
{
month
+=
12
;
year
--
;
}
/*
nday = days_per_month(calendar, year, month);
printf(" year %d, month %d, nday %d\n", year, month, nday);
timeunit = TUNIT_DAY;
*/
}
else
{
...
...
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