I found the solution by myself
I will write it down here, in case somebody else want to do the same.
So I want to create a variable FL that will track the relative flooding time, that is, the percentage of time during the simulation during which a node is flooded (H>0.1). And I want to export it in the result file.
I first declare the variable in declarations_telemac2d.f:
TYPE(BIEF_OBJ),TARGET :: FL
Then I create the object in point_telemac2d.f:
CALL BIEF_ALLVEC(1, FL, 'FL ', IELMT, 1, 2, MESH)
CALL ADDBLO(VARSOR, FL)
CALL OS('X=0 ',X = FL)
The name for the result file is given in nomvar_telemac2d.f (note that I did not verify if the integer I is correct; in my case, NTRAC, NPERIAF and NADVAR are all 0 and it works):
I = 34 + NTRAC + 2 * NPERIAF + NADVAR
TEXTE(I) = 'FLOODING TIME '
TEXTPR(I) = 'FLOODING TIME '
MNEMO(I) = 'FL '
The actual calculation of the variable FL is done in preres_telemac2d.f:
! RELATIVE TIME STEP
RDT = 1.D0 / NIT
!
DO I = 1, NPOIN
IF(H%R(I) > 0.1D0) THEN
FL%R(I) = FL%R(I) + RDT
ENDIF
ENDDO
I hope it can be useful for someone else!