SELECT SUM(FLOOR(( CASE WHEN tm < '12:30' THEN TIME_TO_SEC('12:30') - TIME_TO_SEC(tm) ELSE 0 END + CASE WHEN tm > '13:30' THEN TIME_TO_SEC('18:30') - TIME_TO_SEC(tm) ELSE 5*60*60 END ) / 60 ) ) AS at_outing_time FROM erp_attend_out ;