I have no idea what you're doing.....
I've tried three versions of the formula and the only one to give correct results are the one I posted. Please see the following code and the results:Result:Code:PsuedoSeconds VAR WORD Hours VAR WORD Minutes VAR WORD Start: HSEROUT["Program start",13,13] Minutes = 30 Hours = 0 GOSUB Calculate Minutes = 59 Hours = 0 GOSUB Calculate Minutes = 0 Hours = 1 GOSUB Calculate Hours = 2 Minutes = 15 GOSUB Calculate Hours = 3 Minutes = 59 GOSUB Calculate Hours = 10 Minutes = 0 GOSUB Calculate Pause 100 END Calculate: PsuedoSeconds = (Hours * 3600 + Minutes * 60) / 255 HSEROUT["Version 1: "] GOSUB PrintResult PsuedoSeconds = (Hours * 3600) + (Minutes * 60) / 255 HSEROUT["Version 2: "] GOSUB PrintResult PsuedoSeconds = Hours * 3600 + Minutes * 60 / 255 HSEROUT["Version 3: "] GOSUB PrintResult HSEROUT[13] RETURN PrintResult: HSEROUT[DEC2 Hours, ":", DEC2 Minutes, " - ", DEC PsuedoSeconds,13] RETURNAs you can see, the only one to give correct results are the first one. Why, because the other two both will take the result of the Minutes*60 divided by 255 and add THAT result to Hours*60 while the first (correct) one will divide the sum of the multiplications by 255. How you are getting the correct results from the formula without any parenthesis is beyond me.Code:Program start Version 1: 00:30 - 7 Version 2: 00:30 - 7 Version 3: 00:30 - 7 Version 1: 00:59 - 13 Version 2: 00:59 - 13 Version 3: 00:59 - 13 Version 1: 01:00 - 14 Version 2: 01:00 - 3600 Version 3: 01:00 - 3600 Version 1: 02:15 - 31 Version 2: 02:15 - 7203 Version 3: 02:15 - 7203 Version 1: 03:59 - 56 Version 2: 03:59 - 10813 Version 3: 03:59 - 10813 Version 1: 10:00 - 141 Version 2: 10:00 - 36000 Version 3: 10:00 - 36000
/Henrik.




Bookmarks