Intentaré hacerlo con un código 'genérico' para que sea más comprensible.
Ya lo adaptas a la base de datos que utilices.
Código Delphi
[-]Select FechaInicio, FechaFinal from FECHAS
where Profesor = CodigoSeleccionado
order by FechaInicio
First;
FechaMin := FechaInicio;
FechaMax := FechaFinal;
TotDiasTrabajados := 0;
while not Eof do begin
if (FechaInicio <= FechaMax) and (FechaFinal >= FechaMin) then begin
if FechaFinal > FechaMax then FechaMax := FechaFinal;
end
else begin
TotDiasTrabajados := TotDiasTrabajados + (FechaMax - FechaMin);
FechaMin := FechaInicio;
FechaMax := FechaFinal;
end;
Next;
end;
TotDiasTrabajados := TotDiasTrabajados + (FechaMax - FechaMin);

Pruébalo. Espero sorprenderte con el resultado.
Un saludo.