C$Procedure BETIME ( See if a string "be a time" ) LOGICAL FUNCTION BETIME ( STRING ) C$ Abstract C C Determine if a string is a time string in ISO-format. C C$ Copyright C C Copyright (1996), California Institute of Technology. C U.S. Government sponsorship acknowledged. C C$ Required_Reading C C None. C C$ Keywords C C UTILITY C C$ Declarations IMPLICIT NONE CHARACTER*(*) STRING C$ Brief_I/O C C VARIABLE I/O DESCRIPTION C -------- --- -------------------------------------------------- C STRING I Candidate for a time string. C C The function returns TRUE if STRING can be parsed, else FALSE. C C$ Detailed_Input C C STRING is any character string that may or may not be C a time string. C C$ Detailed_Output C C The function returns TRUE if the string looks like an ISO C time string. Otherwise it returns FALSE. C C$ Parameters C C None. C C$ Files C C None. C C$ Exceptions C C Error free. C C$ Particulars C C This is a utility routine for MAKLABEL. It simply tests C a value to see if it is a time string. It returns TRUE C if it is, FALSE otherwise. C C$ Examples C C See MAKLABEL C C$ Restrictions C C None. C C$ Author_and_Institution C C W.L. Taber (JPL) C C$ Literature_References C C None. C C$ Version C C- SPICELIB Version 1.0.0, 9-DEC-1996 (WLT) C C C-& C$ Index_Entries C C Determine is a string is an ISO time string. C C-& LOGICAL BENUM LOGICAL BEUNS INTEGER LNSIZE PARAMETER ( LNSIZE = 80 ) CHARACTER*(LNSIZE) COPY LOGICAL CASE1 LOGICAL CASE2 C C First make a copy of the input string. C CALL LJUST ( STRING, COPY ) C C There are only two cases. C C YYYY-MM-DDTHR:MN:SC.#### C C and C C YYYY-DDDTHR:MN:SC.##### C C Anything else is regarded as not a time string. C CASE1 = BEUNS(COPY(1:4)) . .AND. COPY(5:5) .EQ. '-' . .AND. BEUNS(COPY(6:7)) . .AND. COPY(8:8) .EQ. '-' . .AND. BEUNS(COPY(9:10)) . .AND. COPY(11:11) .EQ. 'T' . .AND. BEUNS(COPY(12:13)) . .AND. COPY(14:14) .EQ. ':' . .AND. BEUNS(COPY(15:16)) . .AND. COPY(17:17) .EQ. ':' . .AND. BEUNS(COPY(18:19)) . .AND. BENUM(COPY(18:) ) IF ( CASE1 ) THEN BETIME = .TRUE. RETURN END IF CASE2 = BEUNS(COPY(1:4)) . .AND. COPY(5:5) .EQ. '-' . .AND. BEUNS(COPY(6:8)) . .AND. COPY(9:9) .EQ. 'T' . .AND. BEUNS(COPY(10:11)) . .AND. COPY(12:12) .EQ. ':' . .AND. BEUNS(COPY(13:14)) . .AND. COPY(15:15) .EQ. ':' . .AND. BEUNS(COPY(16:17)) . .AND. BENUM(COPY(16:) ) BETIME = CASE2 RETURN END