The calculation above is nice when the job start & end is on the same day, but when the stop time is at 02.00h is and the start time was 18.00h the calculation doesn't funtion as it suposed to do.
( 86400 are the seconds in a day )
work time =
If ( (stopTime + 86400) - startTime > 86400 ; (stopTime - startTime) ; ((stopTime + 86400) - startTime ) - BreakTime )