REAL FUNCTION RCVTTI (TIME, IPOS, IRET) C***************************************************************************** C C Description : This routine convert a time given in notation hh:mm:ss.tt to C a real number indicating the number of seconds past midnight. C The minutes, seconds and ticks are optional. C C Arguments : TIME = STRING with the time C IPOS = optional C input: C INTEGER position in STRING to start search for time C output: C INTEGER position of first character not belonging C to the time specification plus 1 or position of the C end-string character (=zero byte). C if not given input 1 assumed, no output C IRET = return code C -1 - illegal time in string C 0 - empty string C 1 - normal return C 2 - leading non-spaces C 4 - trailing non-spaces C C Author : R. Beetz C AKZO PHARMA, Oss Holland C dept. SDA C C Version : V1.1 Date : 03-jan-83 C C Module name : RCVTTI.FTN C C Package : RSX-LIBRARY C C Compilation/Linking : FOR/F4P/TR:NONE RCVTTI C C Updates : name version C H.A.M. Fikke V1.1 C description : IPOS optional C C***************************************************************************** BYTE TIME(1) C IHOUR=0 IMIN=0 ISEC=0 ITICK=0 IRET=1 IP=1 IF (LARG(2)) IP=IPOS C IHOUR=ICVTS(TIME,IP,IRTRN) !get hours IF (IRTRN .LE. 0) 10,20,20 C THEN 10 IRET=IRTRN !empty string or error GOTO 990 C ENDIF 20 IF ((IRTRN.AND.2) .GT. 0) IRET=IRET.OR.2 !leading non-spaces IF (IHOUR.LT.0 .OR. IHOUR.GT.23) GOTO 980 !illegal number of hours IF ((IRTRN.AND.4) .EQ. 0) GOTO 990 !no more in string IF (TIME(IP-1) .NE. ':') GOTO 970 !trailing non-spaces C IMIN=ICVTS(TIME,IP,IRTRN) !get minutes IF ((IRTRN.LE.0) .OR. ((IRTRN.AND.2) .NE. 0)) GOTO 980 !error IF (IMIN.LT.0 .OR. IMIN.GT.59) GOTO 980 !illegal number of minutes IF ((IRTRN.AND.4) .EQ. 0) GOTO 990 !no more in string IF (TIME(IP-1) .NE. ':') GOTO 970 !trailing non-spaces C ISEC=ICVTS(TIME,IP,IRTRN) !get seconds IF ((IRTRN.LE.0) .OR. ((IRTRN.AND.2) .NE. 0)) GOTO 980 !error IF (ISEC.LT.0 .OR. ISEC.GT.59) GOTO 980 !illegal number of seconds IF ((IRTRN.AND.4) .EQ. 0) GOTO 990 !no more in string IF (TIME(IP-1) .NE. '.') GOTO 970 !trailing non-spaces C ITICK=ICVTS(TIME,IP,IRTRN) !get ticks IF ((IRTRN.LE.0) .OR. ((IRTRN.AND.2) .NE. 0)) GOTO 980 !error IF (ITICK.LT.0 .OR. ITICK.GT.49) GOTO 980 !illegal number of ticks IF ((IRTRN.AND.4) .EQ. 0) GOTO 990 !no more in string GOTO 970 C 980 IRET=-1 !error in time RCVTTI=0 GOTO 999 C 970 IRET=IRET.OR.4 !trailing non-spaces C 990 RCVTTI=IHOUR*3600. + IMIN*60. + ISEC + ITICK/50. C 999 IF (LARG(2)) IPOS=IP RETURN END