in reply to time accumulater

You haven't closed the } on your foreach so I'm assuming your indentation is correct and it should have been just before the first if. If that's right, then your problem is that you need to do
if ($tmin>60){ $rolloverm=$tmin%60; $tmin=$rolloverm; $thrs+= int($tmin/60); # was 1 }
and similarly for $tsec.

Also you should roll over your seconds before you rollover your minutes.