Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with TTOS in app but not always
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Titre:
Problem with TTOS in app but not always
Divers
Thread ID:
00838539
Message ID:
00838539
Vues:
59
My application calculates the number of seconds between two time periods. Based of this calculations it determines how many charges to insert. A customer told me that "sometimes" it drops a charge. I pulled their data back and looked at one of the cases in question, and sure enough, when I run it, it's dropping one second which throws off the charge. I've got the debugger open as it runs the code, and I see the "right" date/time values. In this case:
ttStart=10/03/2003 09:20:00   && DateTime memvar
ttEnd  =10/03/2003 10:00:00   && DateTime memvar
lnSeconds = ttend-ttstart     && Ruturns 2399 in program instead of 2400
I put these values in a command window, and subtract the datetime fields I get 2400. This same case, I can put other time values in and it works perfect. Not sure where to start looking to figure out what I'm doing wrong. Set('seconds')=ON and hours are set to 24. I've watched it all the way until this function is called, and it shows 2400, as soon as it gets here, ttstart-ttend=2399

Here is my code:
* This line calls the the function
lcResults=ctCalcTimeCharges(thisform.Enteror,thisform.ExitOR,lnPrimary,lnSecondary,lnBegins,lnRepeats)
* Program: ctCalTimeCharges
PARAMETERS ttStart,ttEnd,tiPrimeID,tiSecID,tiBegins,tiRepeats
LOCAL lcReturn,lnTotalSecs,lnPriCnt,lnSecCnt

lnTotalSecs=INT(ttEnd-ttStart)
lnPrimeMinutes=tiBegins
lnPrimeSecs=tiBegins*60
lnPriCnt=1
IF lnPrimeSecs > lnTotalSecs
	lnPrimeSecs=lnTotalSecs
	lnPrimeMinutes=INT(lnPrimeSecs / 60)
	lnPriCnt=1
	lnSecCnt=0
	lnSecMinutes=0
ELSE
*	SET STEP ON 
	lnSecSecs=INT(lnTotalSecs-lnPrimeSecs)
	lnSecCnt=INT(lnSecSecs/60)/tiRepeats
	lnIntVersion=INT((lnSecSecs/60)/tiRepeats)
	* See if we need to add an addition
	IF lnSecCnt > lnIntVersion
		*lnSecCnt=lnSecCnt+1
		lnSecCnt=lnIntVersion+1
	ENDIF 
ENDIF
lcReturn=[|]+ALLTRIM(STR(lnPriCnt))+[|]+ALLTRIM(STR(lnSecCnt))+[|]

RETURN (lcReturn)
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform