Found and fixed an issue that occurred on 32-bit linux. When using 5 minutes for a quality timestep, the timestep computed was 299 seconds, not 300. I traced it to an apparent truncation issue in the hour() function in input3.c. The time string is converted into a double value representing the timestep which is then later converted into seconds and cast to a long. it appears that during the cast, the value is truncated to 299, not 300.
git-svn-id: https://epanet.svn.sourceforge.net/svnroot/epanet/BASE/trunk@421 c320cabd-cc23-0410-96d8-e60fbf53ed7f
This commit is contained in:
@@ -1412,8 +1412,7 @@ int timedata()
|
|||||||
if ( (y = hour(Tok[n-1],Tok[n])) < 0.0) return(213);
|
if ( (y = hour(Tok[n-1],Tok[n])) < 0.0) return(213);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t = (long)(3600.0*y);
|
t = (long)(3600.0*y+0.5);
|
||||||
|
|
||||||
/* Process the value assigned to the matched parameter */
|
/* Process the value assigned to the matched parameter */
|
||||||
if (match(Tok[0],w_DURATION)) Dur = t; /* Simulation duration */
|
if (match(Tok[0],w_DURATION)) Dur = t; /* Simulation duration */
|
||||||
else if (match(Tok[0],w_HYDRAULIC)) Hstep = t; /* Hydraulic time step */
|
else if (match(Tok[0],w_HYDRAULIC)) Hstep = t; /* Hydraulic time step */
|
||||||
|
|||||||
Reference in New Issue
Block a user