calculating the hours correctly