1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
FUNCTION SECOND()
DOUBLE PRECISION SECOND
C******************************************************
C
C SECOND, ON EXIT, CONTAINS THE NUMBER OF CPU SECONDS
C SINCE THE START OF THE CALCULATION.
C
C******************************************************
LOGICAL SETOK
CHARACTER*1 X, GETNAM*80
DIMENSION A(2)
SAVE SETOK, SHUT
DATA SETOK / .TRUE. /, SHUT/0.D0/
C
C IF YOU ARE NOT USING A VAX OR A UNIX COMPUTER, UNCOMMENT THE
C NEXT LINE
C CPU=0.0
C
C IF YOU ARE NOT USING A VAX OR A UNIX COMPUTER, REMOVE THE NEXT LINE
Y=ETIME(A)
CPU=A(1)
***********************************************************************
*
* NOW TO SEE IF A FILE LOGICALLY CALLED SHUTDOWN EXISTS, IF IT DOES
* THEN INCREMENT CPU TIME BY 1,000,000 SECONDS.
*
************************************************************************
OPEN(UNIT=4, FILE=GETNAM('SHUTDOWN'),STATUS='UNKNOWN')
READ(4,'(A)',END=10, ERR=10)X
*
* FILE EXISTS, THEREFORE INCREMENT TIME
*
SHUT=1.D6
IF( SETOK) THEN
WRITE(6,'(///10X,''**** JOB STOPPED BY OPERATOR ****'')')
SETOK=.FALSE.
ENDIF
10 CONTINUE
SECOND=CPU+SHUT
CLOSE(4)
RETURN
END
CHARACTER*80 FUNCTION GETNAM(NAMEIN)
C
C THIS FUNCTION IS DESIGNED FOR USE ON A VMS AND ON A UNIX
C SYSTEM. IF YOUR SYSTEM IS VMS, COMMENT OUT THE LINE
C " CALL GETENV(NAMEIN, NAMEOUT)", FURTHER ON IN THIS FUNCTION.
C IF YOUR SYSTEM IS UNIX, MAKE SURE THE LINE IS NOT
C COMMENTED OUT.
C ON A UNIX SYSTEM, GETENV WILL CONSULT THE ENVIRONMENT
C FOR THE CURRENT ALIAS OF THE CHARACTER STRING CONTAINED IN
C 'NAMEIN'. THE ALIAS, IF IT EXISTS, OR THE ORIGINAL NAME IN NAMEIN
C WILL BE RETURNED.
C
CHARACTER*(*) NAMEIN
CHARACTER*(80) NAMEOUT
NAMEOUT=' '
CALL GETENV(NAMEIN, NAMEOUT)
IF (NAMEOUT.EQ.' ') NAMEOUT=NAMEIN
GETNAM = NAMEOUT
RETURN
END
|