Calculate the seconds this way:
seconds := TimeOut - TimeIn;
seconds := @If(seconds < 0; seconds + 24*3600; seconds);
Whenever TimeOut
is smaller then TimeIn
it is assumed that the time frame goes from one day to the next day.
Examples:
TimeIn TimeOut hoursWorked
15:00 01:00 10:00
15:00 14:45 23:45
15:00 17:00 02:00