I actually started to google my question and stumbled on adobe communities. I saw someone had asked what I thought was the same question a few years ago. I copied what they did and I hoped it would work. I know a little about FormCalc but not a lot. I want the employee to be able to enter their time in and their time out and then the formula round it to the nearest quarter hour. Currently our time system uses the 7 and 8 minute rule that I stated above. I tried to attach my timesheet so you could see a visual but it would not allow me.
The first thing I notice is that there are a LOT of endif's missing. From the FormCalc reference: You are not required to have any elseif(...) or else statements as part of your if expression, but you must state the end of the expression with endif. (Emphasis mine.)
Also, towards the end (and this might be due to the lack of endif's) your function calculated the value of StartInterval, then sets it to 0. So, even if the rest of the function was working, that last bit would guarantee that the answer is always 0.
Next, this code seems to be calculating numbers from a table. Do you have your table set up the same way with the same field/object names? Or have you modified this script to match what you have?
Finally, even if the code issues were corrected, this doesn't seem to do what you asked for. From your requirements, I gather that you want the information the user entered to be rounded and copied somewhere else on the form, but this code calculates hours worked, instead. Are you wanting the user's entries to be copied somewhere else and rounded so you can calculate from the rounded numbers? Or are you wanting the hours calculated first, then rounded to the nearest quarter hour?