Commit 8a591cf8 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

taxis: add support for years less than zero

parent fb7bb4c1
......@@ -4,6 +4,7 @@
* replace calendar module by a new one because of date/time problems
with years < 0 [report: Veronika Gayler]
* add module timebase
* taxis: add support for years less than zero
* use always decode_date and encode_date to decode/encode date
* Version 1.0.8 released
......
/* Generated automatically from m214003 on Thu Jul 19 14:54:00 CEST 2007 */
/* Generated automatically from m214003 on Tue Jul 31 09:15:55 CEST 2007 */
/* GRIBLIB_VERSION="1.0.6" */
#if defined (HAVE_CONFIG_H)
# include "config.h"
......@@ -919,7 +921,12 @@ int gribRefDate(int *isec1)
ryear = ISEC1_Year;
if ( ryear != 255 )
ryear = ((ISEC1_Century-1)*100 + ISEC1_Year);
{
if ( ISEC1_Century > 127 )
ryear = ((ISEC1_Century-1-256)*100 + ISEC1_Year);
else
ryear = ((ISEC1_Century-1)*100 + ISEC1_Year);
}
else
ryear = 1;
......@@ -977,7 +984,12 @@ void gribDateTime(int *isec1, int *date, int *time)
if ( ISEC1_Century )
{
if ( ryear != 255 )
ryear = ((ISEC1_Century-1)*100 + ISEC1_Year);
{
if ( ISEC1_Century > 127 )
ryear = ((ISEC1_Century-1-256)*100 + ISEC1_Year);
else
ryear = ((ISEC1_Century-1)*100 + ISEC1_Year);
}
else
ryear = 1;
}
......@@ -8037,7 +8049,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
return (gribLen);
}
static const char grb_libvers[] = "1.0.6" " of ""Jul 19 2007"" ""14:54:00";
static const char grb_libvers[] = "1.0.6" " of ""Jul 31 2007"" ""09:15:56";
......
......@@ -15,10 +15,16 @@ rm -f ${PROG}
DATE=`date`
if test -f config.h ; then
CDILIBVERSION=`grep PACKAGE_VERSION config.h | cut -f3 -d" "`
fi
cat > ${PROG} << EOR
/* Generated automatically from $USER on $DATE */
/* CDILIB_VERSION=$CDILIBVERSION */
#if defined (HAVE_CONFIG_H)
# include "config.h"
#endif
......@@ -99,6 +105,7 @@ cat $c | grep -v '#include' >> ${PROG}
if test -f config.h ; then
cpp -P -DHAVE_CONFIG_H version.c >> ${PROG}
CDIVERSION=`grep PACKAGE_VERSION config.h | cut -f3 -d" "`
else
echo "error: missing config.h"
fi
......
......@@ -999,8 +999,11 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
{
timevalue /= 24;
vdate = (int) timevalue;
vtime = (int) ((timevalue - vdate)*1440 + 0.01);
if ( vdate < 0 )
vtime = (int) (-(timevalue - vdate)*1440 + 0.01);
else
vtime = (int) ((timevalue - vdate)*1440 + 0.01);
hour = vtime / 60;
minute = vtime - hour*60;
vtime = hour*100 + minute;
......@@ -1008,7 +1011,10 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
else if ( timeunit == TUNIT_DAY )
{
vdate = (int) timevalue;
vtime = (int) ((timevalue - vdate)*1440 + 0.01);
if ( vdate < 0 )
vtime = (int) (-(timevalue - vdate)*1440 + 0.01);
else
vtime = (int) ((timevalue - vdate)*1440 + 0.01);
hour = vtime / 60;
minute = vtime - hour*60;
......@@ -1052,7 +1058,10 @@ double encode_timeval(int date, int time, TAXIS *taxis)
{
int hour = time / 100;
int minute = time - hour*100;
timevalue = date + (hour*60 + minute)/1440.;
if ( date < 0 )
timevalue = -(-date + (hour*60 + minute)/1440.);
else
timevalue = date + (hour*60 + minute)/1440.;
}
}
else
......
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