Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
9d4441c3
Commit
9d4441c3
authored
Mar 19, 2010
by
Uwe Schulzweida
Browse files
added support for non integer time units MONTH
parent
eaa89ea9
Changes
4
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
9d4441c3
2010-03-19 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added support for non integer time units MONTH
2010-03-12 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
2010-03-12 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* gauaw: bug fix for allocation of zfnlat for odd number of nlat
* gauaw: bug fix for allocation of zfnlat for odd number of nlat
...
...
configure
View file @
9d4441c3
#! /bin/sh
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for cdi 1.4.3.
2
.
# Generated by GNU Autoconf 2.61 for cdi 1.4.3.
3
.
#
#
# Report bugs to <http://code.zmaw.de/projects/cdi>.
# Report bugs to <http://code.zmaw.de/projects/cdi>.
#
#
...
@@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
...
@@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
# Identity of this package.
PACKAGE_NAME
=
'cdi'
PACKAGE_NAME
=
'cdi'
PACKAGE_TARNAME
=
'cdi'
PACKAGE_TARNAME
=
'cdi'
PACKAGE_VERSION
=
'1.4.3.
2
'
PACKAGE_VERSION
=
'1.4.3.
3
'
PACKAGE_STRING
=
'cdi 1.4.3.
2
'
PACKAGE_STRING
=
'cdi 1.4.3.
3
'
PACKAGE_BUGREPORT
=
'http://code.zmaw.de/projects/cdi'
PACKAGE_BUGREPORT
=
'http://code.zmaw.de/projects/cdi'
# Factoring default headers for most tests.
# Factoring default headers for most tests.
...
@@ -1258,7 +1258,7 @@ if test "$ac_init_help" = "long"; then
...
@@ -1258,7 +1258,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
# This message is too long to be a string in the A/UX 3.1 sh.
cat
<<
_ACEOF
cat
<<
_ACEOF
\`
configure' configures cdi 1.4.3.
2
to adapt to many kinds of systems.
\`
configure' configures cdi 1.4.3.
3
to adapt to many kinds of systems.
Usage:
$0
[OPTION]... [VAR=VALUE]...
Usage:
$0
[OPTION]... [VAR=VALUE]...
...
@@ -1329,7 +1329,7 @@ fi
...
@@ -1329,7 +1329,7 @@ fi
if
test
-n
"
$ac_init_help
"
;
then
if
test
-n
"
$ac_init_help
"
;
then
case
$ac_init_help
in
case
$ac_init_help
in
short
|
recursive
)
echo
"Configuration of cdi 1.4.3.
2
:"
;;
short
|
recursive
)
echo
"Configuration of cdi 1.4.3.
3
:"
;;
esac
esac
cat
<<
\
_ACEOF
cat
<<
\
_ACEOF
...
@@ -1463,7 +1463,7 @@ fi
...
@@ -1463,7 +1463,7 @@ fi
test
-n
"
$ac_init_help
"
&&
exit
$ac_status
test
-n
"
$ac_init_help
"
&&
exit
$ac_status
if
$ac_init_version
;
then
if
$ac_init_version
;
then
cat
<<
\
_ACEOF
cat
<<
\
_ACEOF
cdi configure 1.4.3.
2
cdi configure 1.4.3.
3
generated by GNU Autoconf 2.61
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
...
@@ -1477,7 +1477,7 @@ cat >config.log <<_ACEOF
...
@@ -1477,7 +1477,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
running configure, to aid debugging if configure makes a mistake.
It was created by cdi
$as_me
1.4.3.
2
, which was
It was created by cdi
$as_me
1.4.3.
3
, which was
generated by GNU Autoconf 2.61. Invocation command line was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0
$@
$ $0
$@
...
@@ -2304,7 +2304,7 @@ fi
...
@@ -2304,7 +2304,7 @@ fi
# Define the identity of the package.
# Define the identity of the package.
PACKAGE
=
'cdi'
PACKAGE
=
'cdi'
VERSION
=
'1.4.3.
2
'
VERSION
=
'1.4.3.
3
'
cat
>>
confdefs.h
<<
_ACEOF
cat
>>
confdefs.h
<<
_ACEOF
...
@@ -9275,7 +9275,7 @@ exec 6>&1
...
@@ -9275,7 +9275,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
# values after options handling.
ac_log="
ac_log="
This file was extended by cdi
$as_me
1.4.3.
2
, which was
This file was extended by cdi
$as_me
1.4.3.
3
, which was
generated by GNU Autoconf 2.61. Invocation command line was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES =
$CONFIG_FILES
CONFIG_FILES =
$CONFIG_FILES
...
@@ -9328,7 +9328,7 @@ Report bugs to <bug-autoconf@gnu.org>."
...
@@ -9328,7 +9328,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
_ACEOF
cat
>>
$CONFIG_STATUS
<<
_ACEOF
cat
>>
$CONFIG_STATUS
<<
_ACEOF
ac_cs_version="
\\
ac_cs_version="
\\
cdi config.status 1.4.3.
2
cdi config.status 1.4.3.
3
configured by
$0
, generated by GNU Autoconf 2.61,
configured by
$0
, generated by GNU Autoconf 2.61,
with options
\\
"`echo "
$ac_configure_args
" | sed 's/^ //; s/[
\\
""
\`\$
]/
\\\\
&/g'`
\\
"
with options
\\
"`echo "
$ac_configure_args
" | sed 's/^ //; s/[
\\
""
\`\$
]/
\\\\
&/g'`
\\
"
...
...
configure.ac
View file @
9d4441c3
# Process this file with autoconf to produce a configure script.
# Process this file with autoconf to produce a configure script.
AC_INIT([cdi], [1.4.3.
2
], [http://code.zmaw.de/projects/cdi])
AC_INIT([cdi], [1.4.3.
3
], [http://code.zmaw.de/projects/cdi])
echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}"
echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}"
...
...
src/taxis.c
View file @
9d4441c3
...
@@ -1004,6 +1004,7 @@ void cdiEncodeTimevalue(int days, int secs, int timeunit, double *timevalue)
...
@@ -1004,6 +1004,7 @@ void cdiEncodeTimevalue(int days, int secs, int timeunit, double *timevalue)
}
}
}
}
int
days_per_month
(
int
calendar
,
int
year
,
int
month
);
void
timeval2vtime
(
double
timevalue
,
TAXIS
*
taxis
,
int
*
vdate
,
int
*
vtime
)
void
timeval2vtime
(
double
timevalue
,
TAXIS
*
taxis
,
int
*
vdate
,
int
*
vtime
)
{
{
...
@@ -1034,8 +1035,7 @@ void timeval2vtime(double timevalue, TAXIS *taxis, int *vdate, int *vtime)
...
@@ -1034,8 +1035,7 @@ void timeval2vtime(double timevalue, TAXIS *taxis, int *vdate, int *vtime)
if
(
timeunit
==
TUNIT_MONTH
||
timeunit
==
TUNIT_YEAR
)
if
(
timeunit
==
TUNIT_MONTH
||
timeunit
==
TUNIT_YEAR
)
{
{
int
nmon
/*, nday */
;
static
int
lold
=
FALSE
;
/* double fmon; */
if
(
timeunit
==
TUNIT_YEAR
)
if
(
timeunit
==
TUNIT_YEAR
)
{
{
...
@@ -1043,30 +1043,44 @@ void timeval2vtime(double timevalue, TAXIS *taxis, int *vdate, int *vtime)
...
@@ -1043,30 +1043,44 @@ void timeval2vtime(double timevalue, TAXIS *taxis, int *vdate, int *vtime)
timevalue
*=
12
;
timevalue
*=
12
;
}
}
if
(
(
NINT
(
timevalue
*
10
))
%
10
&&
lwarn
)
if
(
lold
)
{
{
Warning
(
func
,
"Possible wrong calculation of date/time!
\n
"
int
nmon
;
"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
++
;
}
if
(
(
NINT
(
timevalue
*
10
))
%
10
&&
lwarn
)
while
(
month
<
1
)
{
month
+=
12
;
year
--
;
}
{
/*
Warning
(
func
,
"Possible wrong calculation of date/time!
\n
"
nday = days_per_month(calendar, year, month);
"Non integer time offset unsupported for time unit MONTH and YEAR!"
);
printf(" year %d, month %d, nday %d\n", year, month, nday);
lwarn
=
FALSE
;
timeunit = TUNIT_DAY;
}
*/
nmon
=
(
int
)
(
timevalue
+
0
.
001
);
month
+=
nmon
;
while
(
month
>
12
)
{
month
-=
12
;
year
++
;
}
while
(
month
<
1
)
{
month
+=
12
;
year
--
;
}
}
else
{
int
nmon
,
dpm
;
double
fmon
;
nmon
=
(
int
)
timevalue
;
fmon
=
timevalue
-
nmon
;
month
+=
nmon
;
while
(
month
>
12
)
{
month
-=
12
;
year
++
;
}
while
(
month
<
1
)
{
month
+=
12
;
year
--
;
}
dpm
=
days_per_month
(
calendar
,
year
,
month
);
timeunit
=
TUNIT_DAY
;
timevalue
=
fmon
*
dpm
;
}
}
}
else
if
(
timeunit
!=
TUNIT_MONTH
&&
timeunit
!=
TUNIT_YEAR
)
{
{
encode_caldaysec
(
calendar
,
year
,
month
,
day
,
hour
,
minute
,
second
,
&
julday
,
&
secofday
);
encode_caldaysec
(
calendar
,
year
,
month
,
day
,
hour
,
minute
,
second
,
&
julday
,
&
secofday
);
...
@@ -1121,7 +1135,24 @@ double vtime2timeval(int vdate, int vtime, TAXIS *taxis)
...
@@ -1121,7 +1135,24 @@ double vtime2timeval(int vdate, int vtime, TAXIS *taxis)
if
(
timeunit
==
TUNIT_MONTH
||
timeunit
==
TUNIT_YEAR
)
if
(
timeunit
==
TUNIT_MONTH
||
timeunit
==
TUNIT_YEAR
)
{
{
int
nmonth
,
dpm
;
dpm
=
days_per_month
(
calendar
,
year
,
month
);
value
=
(
year
-
ryear
)
*
12
-
rmonth
+
month
;
value
=
(
year
-
ryear
)
*
12
-
rmonth
+
month
;
nmonth
=
(
int
)
value
;
month
-=
nmonth
;
while
(
month
>
12
)
{
month
-=
12
;
year
++
;
}
while
(
month
<
1
)
{
month
+=
12
;
year
--
;
}
encode_caldaysec
(
calendar
,
year
,
month
,
day
,
hour
,
minute
,
second
,
&
julday2
,
&
secofday2
);
julday_sub
(
julday1
,
secofday1
,
julday2
,
secofday2
,
&
days
,
&
secs
);
value
+=
(
days
+
secs
/
86400
.)
/
dpm
;
if
(
timeunit
==
TUNIT_YEAR
)
value
=
NINT
(
value
/
12
);
if
(
timeunit
==
TUNIT_YEAR
)
value
=
NINT
(
value
/
12
);
}
}
else
else
...
...
Write
Preview
Markdown
is supported
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