From 242c03f579cad5a4b3e20d4049c542f2d25b6ce8 Mon Sep 17 00:00:00 2001 From: Tom Taxon Date: Tue, 6 Dec 2011 17:57:57 +0000 Subject: [PATCH] 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 --- src/input3.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/input3.c b/src/input3.c index 6ac9f9e..1c025c9 100755 --- a/src/input3.c +++ b/src/input3.c @@ -1412,8 +1412,7 @@ int timedata() 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 */ if (match(Tok[0],w_DURATION)) Dur = t; /* Simulation duration */ else if (match(Tok[0],w_HYDRAULIC)) Hstep = t; /* Hydraulic time step */