Commit 2af1dde1 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

taxis: changed type of date to int64_t.

parent b64a5686
......@@ -186,7 +186,7 @@ void usage(void)
static
void printInfo(int vdate, int vtime, char *varname, double level,
void printInfo(int64_t vdate, int vtime, char *varname, double level,
size_t datasize, int number, size_t nmiss, double missval, const double *data, int vardis)
{
static int rec = 0;
......@@ -484,7 +484,7 @@ void printShortinfo(int streamID, int vlistID, int vardis)
{
if ( taxisInqType(taxisID) == TAXIS_RELATIVE )
{
int vdate = taxisInqRdate(taxisID);
int64_t vdate = taxisInqRdate(taxisID);
int vtime = taxisInqRtime(taxisID);
cdiDecodeDate(vdate, &year, &month, &day);
......@@ -933,11 +933,11 @@ int main(int argc, char *argv[])
taxisCopyTimestep(taxisID2, taxisID1);
streamDefTimestep(streamID2, tsID);
}
int vdate = taxisInqVdate(taxisID1);
int64_t vdate = taxisInqVdate(taxisID1);
int vtime = taxisInqVtime(taxisID1);
if ( Debug )
fprintf(stdout, "tsID = %d nrecs = %d date = %d time = %d\n", tsID, nrecs, vdate, vtime);
fprintf(stdout, "tsID = %d nrecs = %d date = %lld time = %d\n", tsID, nrecs, vdate, vtime);
if ( Record )
{
......
......@@ -27,7 +27,7 @@ my_reset_text_color(FILE *fp)
}
void
datetime2str(int date, int time, char *datetimestr, int maxlen)
datetime2str(int64_t date, int time, char *datetimestr, int maxlen)
{
int year, month, day;
cdiDecodeDate(date, &year, &month, &day);
......@@ -39,7 +39,7 @@ datetime2str(int date, int time, char *datetimestr, int maxlen)
}
void
date2str(int date, char *datestr, int maxlen)
date2str(int64_t date, char *datestr, int maxlen)
{
int year, month, day;
cdiDecodeDate(date, &year, &month, &day);
......@@ -623,7 +623,7 @@ printSubtypeInfo(int vlistID)
}
static int
printDateTime(int ntimeout, int vdate, int vtime)
printDateTime(int ntimeout, int64_t vdate, int vtime)
{
char vdatestr[32], vtimestr[32];
......@@ -674,7 +674,7 @@ printTimesteps(int streamID, int taxisID, int verbose)
int nrecs;
struct datetime
{
int vdate;
int64_t vdate;
int vtime;
struct datetime *next;
};
......@@ -698,10 +698,10 @@ printTimesteps(int streamID, int taxisID, int verbose)
{
#ifdef CDO
dtlist_taxisInqTimestep(dtlist, taxisID, 0);
int vdate = dtlist_get_vdate(dtlist, 0);
int64_t vdate = dtlist_get_vdate(dtlist, 0);
int vtime = dtlist_get_vtime(dtlist, 0);
#else
int vdate = taxisInqVdate(taxisID);
int64_t vdate = taxisInqVdate(taxisID);
int vtime = taxisInqVtime(taxisID);
#endif
......@@ -748,7 +748,7 @@ printTimesteps(int streamID, int taxisID, int verbose)
}
for (int i = toff; i < nvdatetime; ++i)
{
int vdate = next_vdatetime->vdate;
int64_t vdate = next_vdatetime->vdate;
int vtime = next_vdatetime->vtime;
ntimeout = printDateTime(ntimeout, vdate, vtime);
next_vdatetime = next_vdatetime->next;
......
......@@ -1146,37 +1146,37 @@ void taxisCopyTimestep(int taxisIDdes, int taxisIDsrc);
void taxisDefType(int taxisID, int type);
/* taxisDefVdate: Define the verification date */
void taxisDefVdate(int taxisID, int date);
void taxisDefVdate(int taxisID, int64_t date);
/* taxisDefVtime: Define the verification time */
void taxisDefVtime(int taxisID, int time);
/* taxisInqVdate: Get the verification date */
int taxisInqVdate(int taxisID);
int64_t taxisInqVdate(int taxisID);
/* taxisInqVtime: Get the verification time */
int taxisInqVtime(int taxisID);
/* taxisDefRdate: Define the reference date */
void taxisDefRdate(int taxisID, int date);
void taxisDefRdate(int taxisID, int64_t date);
/* taxisDefRtime: Define the reference time */
void taxisDefRtime(int taxisID, int time);
/* taxisInqRdate: Get the reference date */
int taxisInqRdate(int taxisID);
int64_t taxisInqRdate(int taxisID);
/* taxisInqRtime: Get the reference time */
int taxisInqRtime(int taxisID);
/* taxisDefFdate: Define the forecast reference date */
void taxisDefFdate(int taxisID, int date);
void taxisDefFdate(int taxisID, int64_t date);
/* taxisDefFtime: Define the forecast reference time */
void taxisDefFtime(int taxisID, int time);
/* taxisInqFdate: Get the forecast reference date */
int taxisInqFdate(int taxisID);
int64_t taxisInqFdate(int taxisID);
/* taxisInqFtime: Get the forecast reference time */
int taxisInqFtime(int taxisID);
......@@ -1186,11 +1186,11 @@ void taxisWithBounds(int taxisID);
void taxisDeleteBounds(int taxisID);
void taxisDefVdateBounds(int taxisID, int vdate_lb, int vdate_ub);
void taxisDefVdateBounds(int taxisID, int64_t vdate_lb, int64_t vdate_ub);
void taxisDefVtimeBounds(int taxisID, int vtime_lb, int vtime_ub);
void taxisInqVdateBounds(int taxisID, int *vdate_lb, int *vdate_ub);
void taxisInqVdateBounds(int taxisID, int64_t *vdate_lb, int64_t *vdate_ub);
void taxisInqVtimeBounds(int taxisID, int *vtime_lb, int *vtime_ub);
......
......@@ -661,24 +661,68 @@ FCALLSCSUB1 (taxisDestroy, TAXISDESTROY, taxisdestroy, INT)
FCALLSCFUN1 (INT, taxisDuplicate, TAXISDUPLICATE, taxisduplicate, INT)
FCALLSCSUB2 (taxisCopyTimestep, TAXISCOPYTIMESTEP, taxiscopytimestep, INT, INT)
FCALLSCSUB2 (taxisDefType, TAXISDEFTYPE, taxisdeftype, INT, INT)
FCALLSCSUB2 (taxisDefVdate, TAXISDEFVDATE, taxisdefvdate, INT, INT)
static void taxisDefVdate_fwrap(int taxisID, int date)
{
taxisDefVdate(taxisID, (int64_t)date);
}
FCALLSCSUB2 (taxisDefVdate_fwrap, TAXISDEFVDATE, taxisdefvdate, INT, INT)
FCALLSCSUB2 (taxisDefVtime, TAXISDEFVTIME, taxisdefvtime, INT, INT)
FCALLSCFUN1 (INT, taxisInqVdate, TAXISINQVDATE, taxisinqvdate, INT)
static int taxisInqVdate_fwrap(int taxisID)
{
int64_t v;
v = taxisInqVdate(taxisID);
return int64_t_c2f(v);
}
FCALLSCFUN1 (INT, taxisInqVdate_fwrap, TAXISINQVDATE, taxisinqvdate, INT)
FCALLSCFUN1 (INT, taxisInqVtime, TAXISINQVTIME, taxisinqvtime, INT)
FCALLSCSUB2 (taxisDefRdate, TAXISDEFRDATE, taxisdefrdate, INT, INT)
static void taxisDefRdate_fwrap(int taxisID, int date)
{
taxisDefRdate(taxisID, (int64_t)date);
}
FCALLSCSUB2 (taxisDefRdate_fwrap, TAXISDEFRDATE, taxisdefrdate, INT, INT)
FCALLSCSUB2 (taxisDefRtime, TAXISDEFRTIME, taxisdefrtime, INT, INT)
FCALLSCFUN1 (INT, taxisInqRdate, TAXISINQRDATE, taxisinqrdate, INT)
static int taxisInqRdate_fwrap(int taxisID)
{
int64_t v;
v = taxisInqRdate(taxisID);
return int64_t_c2f(v);
}
FCALLSCFUN1 (INT, taxisInqRdate_fwrap, TAXISINQRDATE, taxisinqrdate, INT)
FCALLSCFUN1 (INT, taxisInqRtime, TAXISINQRTIME, taxisinqrtime, INT)
FCALLSCSUB2 (taxisDefFdate, TAXISDEFFDATE, taxisdeffdate, INT, INT)
static void taxisDefFdate_fwrap(int taxisID, int date)
{
taxisDefFdate(taxisID, (int64_t)date);
}
FCALLSCSUB2 (taxisDefFdate_fwrap, TAXISDEFFDATE, taxisdeffdate, INT, INT)
FCALLSCSUB2 (taxisDefFtime, TAXISDEFFTIME, taxisdefftime, INT, INT)
FCALLSCFUN1 (INT, taxisInqFdate, TAXISINQFDATE, taxisinqfdate, INT)
static int taxisInqFdate_fwrap(int taxisID)
{
int64_t v;
v = taxisInqFdate(taxisID);
return int64_t_c2f(v);
}
FCALLSCFUN1 (INT, taxisInqFdate_fwrap, TAXISINQFDATE, taxisinqfdate, INT)
FCALLSCFUN1 (INT, taxisInqFtime, TAXISINQFTIME, taxisinqftime, INT)
FCALLSCFUN1 (INT, taxisHasBounds, TAXISHASBOUNDS, taxishasbounds, INT)
FCALLSCSUB1 (taxisWithBounds, TAXISWITHBOUNDS, taxiswithbounds, INT)
FCALLSCSUB1 (taxisDeleteBounds, TAXISDELETEBOUNDS, taxisdeletebounds, INT)
FCALLSCSUB3 (taxisDefVdateBounds, TAXISDEFVDATEBOUNDS, taxisdefvdatebounds, INT, INT, INT)
static void taxisDefVdateBounds_fwrap(int taxisID, int vdate_lb, int vdate_ub)
{
taxisDefVdateBounds(taxisID, (int64_t)vdate_lb, (int64_t)vdate_ub);
}
FCALLSCSUB3 (taxisDefVdateBounds_fwrap, TAXISDEFVDATEBOUNDS, taxisdefvdatebounds, INT, INT, INT)
FCALLSCSUB3 (taxisDefVtimeBounds, TAXISDEFVTIMEBOUNDS, taxisdefvtimebounds, INT, INT, INT)
FCALLSCSUB3 (taxisInqVdateBounds, TAXISINQVDATEBOUNDS, taxisinqvdatebounds, INT, PINT, PINT)
static void taxisInqVdateBounds_fwrap(int taxisID, int *vdate_lb, int *vdate_ub)
{
int64_t vdate_lb_int64_t;
int64_t vdate_ub_int64_t;
taxisInqVdateBounds(taxisID, &vdate_lb_int64_t, &vdate_ub_int64_t);
assert(vdate_lb_int64_t < INT_MAX);
*vdate_lb = vdate_lb_int64_t;
assert(vdate_ub_int64_t < INT_MAX);
*vdate_ub = vdate_ub_int64_t;
}
FCALLSCSUB3 (taxisInqVdateBounds_fwrap, TAXISINQVDATEBOUNDS, taxisinqvdatebounds, INT, PINT, PINT)
FCALLSCSUB3 (taxisInqVtimeBounds, TAXISINQVTIMEBOUNDS, taxisinqvtimebounds, INT, PINT, PINT)
FCALLSCSUB2 (taxisDefCalendar, TAXISDEFCALENDAR, taxisdefcalendar, INT, INT)
FCALLSCFUN1 (INT, taxisInqCalendar, TAXISINQCALENDAR, taxisinqcalendar, INT)
......
......@@ -55,10 +55,10 @@ bool str_is_equal(const char *vstr, const char *cstr);
#ifndef _TIMEBASE_H
# include "timebase.h"
#endif
#ifndef _TAXIS_H
#ifndef TAXIS_H
# include "taxis.h"
#endif
#ifndef CDI_LIMITS_H
#ifndef CDI_LIMITS_H
# include "cdi_limits.h"
#endif
#ifndef _SERVICE_H
......
......@@ -87,7 +87,7 @@ static void doctotxt(FILE *fp, Docu *doc, size_t ndoc)
}
enum cftype {ISVOID, ISCONSTSTRING, ISINT, ISREAL, ISDOUBLE, ISINT64T, ISSIZET, ISMPI_COMM,
ISXT_IDXLIST, ISCHOICE, ISINTP, ISSIZETP, ISFLOATV, ISFLOATVV,
ISXT_IDXLIST, ISCHOICE, ISINTP, ISINT64TP, ISSIZETP, ISFLOATV, ISFLOATVV,
ISDOUBLEV, ISDOUBLEVV, ISINTV, ISINTVV, ISINTVVV, ISREALP,
ISDOUBLEP, ISCBUF, ISUUID, ISUCHAR, ISSTRING, ISSTRINGP,
VOIDFUNCVOID,
......@@ -113,6 +113,9 @@ static int cfInt64tConvert(FILE *outfp, const char *argName,
static int cfSizetConvert(FILE *outfp, const char *argName,
size_t argNameLen, enum conversionType part);
static int cfInt64tpConvert(FILE *outfp, const char *argName,
size_t argNameLen, enum conversionType part);
static int cfSizetpConvert(FILE *outfp, const char *argName,
size_t argNameLen, enum conversionType part);
......@@ -181,6 +184,9 @@ static struct symbol funArgSym[]
"^"WS"*const"WS"+void"WS"*\\*"WS"*"SYMRE"?"WS"*[,\\)]", 1, 0, 0 },
{ "INTEGER", "PINT", "%sint *%.*s",
"^"WS"*(const"WS"+)?int"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, 0, 0 },
{ "INTEGER", "PINT", "%sint64_t *%.*s",
"^"WS"*(const"WS"+)?int64_t"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, 1, 0,
cfInt64tpConvert, "%sint *%.*s"},
{ "INTEGER", "PINT", "%ssize_t *%.*s",
"^"WS"*(const"WS"+)?size_t"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, 1, 0,
cfSizetpConvert, "%sint *%.*s"},
......@@ -716,6 +722,12 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
fputs(")\n{\n", fpint);
for (size_t i = 0; i < funcargc; i++ )
{
if (funArgSym[funcargtype[i]].convert && funcargtype[i] == ISINT64TP)
{
// create temporary int64_t variable
fprintf(fpint, " int64_t %.*s_int64_t;\n",
(int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so);
}
if (funArgSym[funcargtype[i]].convert && funcargtype[i] == ISSIZETP)
{
// create temporary size_t variable
......@@ -752,6 +764,15 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
fputs(");\n", fpint);
for (size_t i = 0; i < funcargc; i++ )
{
if (funArgSym[funcargtype[i]].convert && funcargtype[i] == ISINT64TP)
{
fprintf(fpint, " assert(%.*s_int64_t < INT_MAX);\n",
(int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so);
// copy temporary int64_t variable
fprintf(fpint, " *%.*s = %.*s_int64_t;\n",
(int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so,
(int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so);
}
if (funArgSym[funcargtype[i]].convert && funcargtype[i] == ISSIZETP)
{
fprintf(fpint, " assert(%.*s_size_t < INT_MAX);\n",
......@@ -1290,6 +1311,24 @@ static int cfSizetConvert(FILE *outfp, const char *argName,
return retval;
}
/* emit conversion code for size_t* argument */
static int cfInt64tpConvert(FILE *outfp, const char *argName,
size_t argNameLen, enum conversionType part)
{
int retval = 0;
switch (part)
{
case CONV_ARG:
retval = fprintf(outfp, "&%.*s_int64_t", (int)argNameLen, argName);
break;
case CONV_RET:
abort();
break;
}
return retval;
}
/* emit conversion code for size_t* argument */
static int cfSizetpConvert(FILE *outfp, const char *argName,
size_t argNameLen, enum conversionType part)
......
......@@ -115,7 +115,7 @@ ncvar_t;
static
void scanTimeString(const char *ptu, int *rdate, int *rtime)
void scanTimeString(const char *ptu, int64_t *rdate, int *rtime)
{
int year = 1, month = 1, day = 1;
int hour = 0, minute = 0, second = 0;
......@@ -196,7 +196,8 @@ static
int setBaseTime(const char *timeunits, taxis_t *taxis)
{
int taxistype = TAXIS_ABSOLUTE;
int rdate = -1, rtime = -1;
int64_t rdate = -1;
int rtime = -1;
size_t len = strlen(timeunits);
while ( isspace(*timeunits) && len ) { timeunits++; len--; }
......@@ -254,7 +255,7 @@ int setBaseTime(const char *timeunits, taxis_t *taxis)
taxis->rtime = rtime;
if ( CDI_Debug )
Message("rdate = %d rtime = %d", rdate, rtime);
Message("rdate = %lld rtime = %d", rdate, rtime);
}
}
}
......
......@@ -312,7 +312,7 @@ void taxisDefType(int taxisID, int type)
@Function taxisDefVdate
@Title Define the verification date
@Prototype void taxisDefVdate(int taxisID, int vdate)
@Prototype void taxisDefVdate(int taxisID, int64_t vdate)
@Parameter
@Item taxisID Time axis ID, from a previous call to @fref{taxisCreate}
@Item vdate Verification date (YYYYMMDD)
......@@ -322,7 +322,7 @@ The function @func{taxisDefVdate} defines the verification date of a Time axis.
@EndFunction
*/
void taxisDefVdate(int taxisID, int vdate)
void taxisDefVdate(int taxisID, int64_t vdate)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
......@@ -362,7 +362,7 @@ void taxisDefVtime(int taxisID, int vtime)
@Function taxisDefRdate
@Title Define the reference date
@Prototype void taxisDefRdate(int taxisID, int rdate)
@Prototype void taxisDefRdate(int taxisID, int64_t rdate)
@Parameter
@Item taxisID Time axis ID, from a previous call to @fref{taxisCreate}
@Item rdate Reference date (YYYYMMDD)
......@@ -372,7 +372,7 @@ The function @func{taxisDefRdate} defines the reference date of a Time axis.
@EndFunction
*/
void taxisDefRdate(int taxisID, int rdate)
void taxisDefRdate(int taxisID, int64_t rdate)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -423,7 +423,7 @@ void taxisDefRtime(int taxisID, int rtime)
@Function taxisDefFdate
@Title Define the forecast reference date
@Prototype void taxisDefFdate(int taxisID, int fdate)
@Prototype void taxisDefFdate(int taxisID, int64_t fdate)
@Parameter
@Item taxisID Time axis ID, from a previous call to @fref{taxisCreate}
@Item fdate Forecast reference date (YYYYMMDD)
......@@ -433,7 +433,7 @@ The function @func{taxisDefFdate} defines the forecast reference date of a Time
@EndFunction
*/
void taxisDefFdate(int taxisID, int fdate)
void taxisDefFdate(int taxisID, int64_t fdate)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -638,14 +638,14 @@ The function @func{taxisInqVdate} returns the verification date of a Time axis.
@EndFunction
*/
int taxisInqVdate(int taxisID)
int64_t taxisInqVdate(int taxisID)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
return taxisptr->vdate;
}
void taxisInqVdateBounds(int taxisID, int *vdate_lb, int *vdate_ub)
void taxisInqVdateBounds(int taxisID, int64_t *vdate_lb, int64_t *vdate_ub)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
......@@ -654,7 +654,7 @@ void taxisInqVdateBounds(int taxisID, int *vdate_lb, int *vdate_ub)
}
void taxisDefVdateBounds(int taxisID, int vdate_lb, int vdate_ub)
void taxisDefVdateBounds(int taxisID, int64_t vdate_lb, int64_t vdate_ub)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
......@@ -720,7 +720,7 @@ void taxisDefVtimeBounds(int taxisID, int vtime_lb, int vtime_ub)
@Function taxisInqRdate
@Title Get the reference date
@Prototype int taxisInqRdate(int taxisID)
@Prototype int64_t taxisInqRdate(int taxisID)
@Parameter
@Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} or @fref{vlistInqTaxis}
......@@ -732,7 +732,7 @@ The function @func{taxisInqRdate} returns the reference date of a Time axis.
@EndFunction
*/
int taxisInqRdate(int taxisID)
int64_t taxisInqRdate(int taxisID)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
......@@ -780,7 +780,7 @@ int taxisInqRtime(int taxisID)
@Function taxisInqFdate
@Title Get the forecast reference date
@Prototype int taxisInqFdate(int taxisID)
@Prototype int64_t taxisInqFdate(int taxisID)
@Parameter
@Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} or @fref{vlistInqTaxis}
......@@ -792,7 +792,7 @@ The function @func{taxisInqFdate} returns the forecast reference date of a Time
@EndFunction
*/
int taxisInqFdate(int taxisID)
int64_t taxisInqFdate(int taxisID)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
......@@ -1029,9 +1029,9 @@ void cdiEncodeTimevalue(int days, int secs, int timeunit, double *timevalue)
}
void timeval2vtime(double timevalue, taxis_t *taxis, int *vdate, int *vtime)
void timeval2vtime(double timevalue, taxis_t *taxis, int64_t *vdate, int *vtime)
{
int rdate = taxis->rdate;
int64_t rdate = taxis->rdate;
int rtime = taxis->rtime;
if ( DBL_IS_EQUAL(timevalue, 0.) )
......@@ -1085,7 +1085,7 @@ void timeval2vtime(double timevalue, taxis_t *taxis, int *vdate, int *vtime)
}
double vtime2timeval(int vdate, int vtime, taxis_t *taxis)
double vtime2timeval(int64_t vdate, int vtime, taxis_t *taxis)
{
double value = 0;
int julday1, secofday1, julday2, secofday2, days, secs;
......@@ -1093,7 +1093,7 @@ double vtime2timeval(int vdate, int vtime, taxis_t *taxis)
int timeunit = (*taxis).unit;
int calendar = (*taxis).calendar;
int rdate = (*taxis).rdate;
int64_t rdate = (*taxis).rdate;
int rtime = (*taxis).rtime;
if ( rdate == -1 )
{
......@@ -1159,11 +1159,11 @@ double vtime2timeval(int vdate, int vtime, taxis_t *taxis)
static
void conv_timeval(double timevalue, int *rvdate, int *rvtime)
void conv_timeval(double timevalue, int64_t *rvdate, int *rvtime)
{
int daysec;
int vdate = (int) timevalue;
int64_t vdate = (int) timevalue;
if ( vdate < 0 )
daysec = (int) (-(timevalue - vdate)*86400 + 0.01);
else
......@@ -1180,9 +1180,10 @@ void conv_timeval(double timevalue, int *rvdate, int *rvtime)
static
void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
void splitTimevalue(double timevalue, int timeunit, int64_t *date, int *time)
{
int vdate = 0, vtime = 0;
int64_t vdate = 0;
int vtime = 0;
if ( timeunit == TUNIT_SECOND )
{
......@@ -1200,7 +1201,7 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
}
else if ( timeunit == TUNIT_MONTH )
{
vdate = (int) timevalue*100 - ((vdate < 0) * 2 - 1);
vdate = (int64_t) timevalue*100 - ((vdate < 0) * 2 - 1);
vtime = 0;
}
else if ( timeunit == TUNIT_YEAR )
......@@ -1216,7 +1217,7 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
timevalue = 214700;
}
vdate = (int) timevalue*10000;
vdate = (int64_t) timevalue*10000;
vdate += 101;
vtime = 0;
}
......@@ -1272,7 +1273,7 @@ void cdiSetForecastPeriod(double timevalue, taxis_t *taxis)
int timeunit = (*taxis).fc_unit;
int calendar = (*taxis).calendar;
int vdate = (*taxis).vdate;
int64_t vdate = (*taxis).vdate;
int vtime = (*taxis).vtime;
if ( vdate == 0 && vtime == 0 && DBL_IS_EQUAL(timevalue, 0.) ) return;
......@@ -1320,7 +1321,7 @@ void cdiSetForecastPeriod(double timevalue, taxis_t *taxis)
}
void cdiDecodeTimeval(double timevalue, taxis_t *taxis, int *date, int *time)
void cdiDecodeTimeval(double timevalue, taxis_t *taxis, int64_t *date, int *time)
{
if ( taxis->type == TAXIS_ABSOLUTE )
splitTimevalue(timevalue, taxis->unit, date, time);
......@@ -1329,7 +1330,7 @@ void cdiDecodeTimeval(double timevalue, taxis_t *taxis, int *date, int *time)
}
double cdiEncodeTimeval(int date, int time, taxis_t *taxis)
double cdiEncodeTimeval(int64_t date, int time, taxis_t *taxis)
{
double timevalue;
......@@ -1413,7 +1414,7 @@ void ptaxisCopy(taxis_t *dest, taxis_t *source)
static void
taxisPrintKernel(taxis_t * taxisptr, FILE * fp)
{
int vdate_lb, vdate_ub;
int64_t vdate_lb, vdate_ub;
int vtime_lb, vtime_ub;
taxisInqVdateBounds ( taxisptr->self, &vdate_lb, &vdate_ub);
......@@ -1426,20 +1427,20 @@ taxisPrintKernel(taxis_t * taxisptr, FILE * fp)
"self = %d\n"
"used = %d\n"
"type = %d\n"
"vdate = %d\n"
"vdate = %lld\n"
"vtime = %d\n"
"rdate = %d\n"
"rdate = %lld\n"
"rtime = %d\n"
"fdate = %d\n"
"fdate = %lld\n"
"ftime = %d\n"
"calendar = %d\n"
"unit = %d\n"
"numavg = %d\n"
"climatology = %d\n"
"has_bounds = %d\n"
"vdate_lb = %d\n"
"vdate_lb = %lld\n"
"vtime_lb = %d\n"
"vdate_ub = %d\n"
"vdate_ub = %lld\n"
"vtime_ub = %d\n"
"fc_unit = %d\n"
"fc_period = %g\n"
......
#ifndef _TAXIS_H
#define _TAXIS_H
#ifndef TAXIS_H
#define TAXIS_H
#include <stdbool.h>
......@@ -15,19 +15,19 @@ typedef struct {
short has_bounds;
int datatype; // datatype
int type; // time type
int vdate; // verification date
int64_t vdate; // verification date
int vtime; // verification time
int rdate; // reference date
int64_t rdate; // reference date
int rtime; // reference time
int fdate; // forecast reference date
int64_t fdate; // forecast reference date
int ftime; // forecast reference time
int calendar;
int unit; // time unit
int numavg;
bool climatology;
int vdate_lb; // lower bounds of vdate
int64_t vdate_lb; // lower bounds of vdate
int vtime_lb; // lower bounds of vtime
int vdate_ub; // upper bounds of vdate
int64_t vdate_ub; // upper bounds of vdate
int vtime_ub; // upper bounds of vtime
int fc_unit; // forecast time unit
double fc_period; // forecast time period
......@@ -41,10 +41,10 @@ void ptaxisInit(taxis_t* taxis);
void ptaxisCopy(taxis_t* dest, taxis_t* source);
taxis_t* taxisPtr(int taxisID);
void cdiSetForecastPeriod(double timevalue, taxis_t *taxis);
void cdiDecodeTimeval(double timevalue, taxis_t* taxis, int* date, int* time);
double cdiEncodeTimeval(int date, int time, taxis_t* taxis);
void timeval2vtime(double timevalue, taxis_t* taxis, int* vdate, int* vtime);