HP 3000 Manuals

FORTRAN Intrinsic Functions and Subroutines [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Reference

FORTRAN Intrinsic Functions and Subroutines 

Following are system intrinsics accessed with the NOSTANDARD SYSTEM
compiler directive.

DATE Subroutine 

DATE returns a string in the form dd-mmm-yy (for example, 15-SEP-88).

DATE is called as follows:

     CHARACTER*9 DSTRING
     CALL DATE(DSTRING)

IDATE Subroutine 

IDATE returns three integer values representing the current month, day,
and year.  IDATE is called as follows:

     INTEGER MONTH,DAY,YEAR
     CALL IDATE(MONTH,DAY,YEAR)

YEAR returns a two digit number in the range of zero to 99.  To obtain a
four-digit calendar year, add 1900 to YEAR.

EXIT Subroutine 

EXIT causes a program to terminate as if a STOP statement without an
argument was encountered.

Following is the syntax for EXIT:

     CALL EXIT()

The above call to EXIT terminates the program and returns control to the
operating system.

RAN Function 

RAN is a general random number generator of the multiplicative
congruential type.  The result is a floating-point number that is
uniformly distributed in the range between 0.0 inclusive and 1.0,
exclusive.  Following is a call to RAN:

     Y = RAN(ISEED)

where ISEED must be an INTEGER*4 constant, variable, or array element.

RAN stores a value in ISEED and uses it later to calculate the next
random number.  RAN uses the following algorithm to calculate the value
and update the seed:

     SEED = MOD(69069 * SEED + 1,2 ** 32)

SEED is a 32-bit number whose high-order 24 bits are converted to a
floating-point number and stored in Y. RAN returns Y and stores the new
seed in ISEED.

SECNDS Function 

SECNDS returns the number of seconds elapsed since midnight minus the
number of seconds passed in as an argument.  SECNDS measures intervals of
seconds up to 24 hours.  It can handle cases where the start time is
before midnight and the end time is after, as long as the interval does
not exceed 24 hours.

Example 

     $NOSTANDARD SYSTEM
            PROGRAM benchmark
            REAL*4 TIME0,TIME1
            INTEGER I

            TIME0 = SECNDS (0.0)
            PRINT *,TIME0

     C      code to be limited
            F = 0.0
            DO I = 1,100
              F = SIN(REAL(I)) + F
            END DO
     C      end code to be timed

            TIME1 = SECNDS (TIME0)
            PRINT *,TIME1
            END

The second call to SECNDS returns the seconds elapsed since midnight
minus the number of seconds passed in by TIME0.


NOTE Functions RAN and SECNDS cannot be used with the $HP3000_16 ON directive. This directive causes the floating-point format to be classic HP 3000 instead of IEEE, and will not be recognized by these functions. The compiler attempts to find a compatibility mode routine for these which does not exist. An alternative is to use the MPE/iX TIMER intrinsic. For example, to get the number of seconds after midnight you would compile and execute: $STANDARD_LEVEL SYSTEM PROGRAM cktimer SYSTEM INTRINSIC TIMER INTEGER*4 I, T T = TIMER() I = MOD((T/1000), 86400) PRINT *,I END where 86400 is the number of seconds per day. The value is an integer.
TIME Subroutine TIME returns a string in the form hh:mm:ss (for example, 22:10:30). TIME is called as follows: $NOSTANDARD SYSTEM PROGRAM checktime CHARACTER*8 timebuff CALL TIME(timebuff) PRINT *,timebuff END Setting the TZ Environment Variable. To get the correct time, you must set the evironment variable TZ to your local time zone. To set the TZ, use the MPE/iX SETVAR command. For example, the following command sets the time zone to Central Standard Time and Central Daylight Time, which would be correct for Chicago, Illinois: :SETVAR TZ 'CST6CDT' The following table lists some time zones. Check you local time zone to be sure you use the correct one. Table B-8. Time Zones and TZ Environment Variable Values ------------------------------------------------------------------------------- | | | | | TZ Values | Time Zone | Geographic Area | | | | | ------------------------------------------------------------------------------- | | | | | HST10 | Hawaiian Standard Time, | United States: Hawaii. | | | Hawaiian Daylight Time. | | | | | | ------------------------------------------------------------------------------- | | | | | AST10ADT | Aleutian Standard Time, | United States: Alaska | | | Aleutian Daylight Time. | (parts). | | | | | ------------------------------------------------------------------------------- | | | | | YST9YDT | Yukon Standard Time, Yukon | United States: Alaska | | | Daylight Time. | (parts). | | | | | ------------------------------------------------------------------------------- | | | | | PST3PDT | Pacific Standard Time, | Canada: British Columbia. | | | Pacific Daylight Time. | United States: California, | | | | Idaho(parts), Nevada, Oregon | | | | (parts), Washington. | | | | | ------------------------------------------------------------------------------- | | | | | MST7MDT | Mountain Standard Time, | Canada: Alberta, Saskatchewan | | | Mountain Daylight Time. | (parts). United States: | | | | Colorado, Idaho (parts), | | | | Kansas (parts), Montana, | | | | Nebraska (parts), New Mexico, | | | | North Dakota (parts), Oregon | | | | (parts), South Dakota (parts), | | | | Texas (parts), Utah, Wyoming. | | | | | ------------------------------------------------------------------------------- | | | | | MST7 | Mountain Standard Time. | United States: Arizona. | | | | | ------------------------------------------------------------------------------- | | | | | CST6CDT | Central Standard Time, | Canada: Manitoba, Ontario | | | Central Daylight Time. | (parts), Saskatchewan (parts). | | | | United States: Alabama, | | | | Arkansas, Florida (parts), | | | | Illinois, Iowa, Kansas, | | | | Kentucky (parts), Louisiana, | | | | Michigan (parts), Minnesota, | | | | Mississippi, Missouri, | | | | Nebraska, North Dakota, | | | | Oklahoma, South Dakota, | | | | Tennessee (parts), Texas, | | | | Wisconsin. | | | | | ------------------------------------------------------------------------------- | | | | | EST6CDT | Eastern Standard Time, | United States: Indiana | | | Central Daylight Time. | (most). | | | | | ------------------------------------------------------------------------------- | | | | | EST5EDT | Eastern Standard Time, | Canada: Ontario (parts), | | | Eastern Daylight Time. | Quebec (parts). United | | | | States: Connecticut, | | | | Delaware, District of | | | | Columbia, Florida, Georgia, | | | | Kentucky, Maine, Maryland, | | | | Massachusetts, Michigan, New | | | | Hampshire, New Jersey, New | | | | York, North Carolina, Ohio, | | | | Pennsylvania, Rhode Island, | | | | South Carolina, Tennessee | | | | (parts), Vermont, Virginia, | | | | West Virginia. | | | | | ------------------------------------------------------------------------------- | | | | | AST4ADT | Atlantic Standard Time, | Canada: Newfoundland (parts), | | | Atlantic Daylight Time. | Nova Scotia, Prince Edward | | | | Island, Quebec (parts). | | | | | ------------------------------------------------------------------------------- | | | | | NST3:30NDT | Newfoundland Standard Time, | Canada: Newfoundland (parts). | | | Newfoundland Daylight Time. | | | | | | ------------------------------------------------------------------------------- | | | | | WET0WETDST | Western European Time, | Great Britain, Ireland. | | | Western European Time | | | | Daylight Savings Time. | | | | | | ------------------------------------------------------------------------------- | | | | | PWT0PST | Portuguese Winter Time, | | | | Portuguese Summer Time | | | | | | ------------------------------------------------------------------------------- | | | | | MEZ-1MESZ | Mitteleuropaeische Zeit, | | | | Mitteleuropaeische | | | | Sommerziet. | | | | | | ------------------------------------------------------------------------------- | | | | | MET-1METDST | Middle European Time, | Belgium, Luxembourg, | | | Middle European Time | Netherlands, Denmark, Norway, | | | Daylight Savings Time. | Austria, Poland, | | | | Czechoslovakia, Sweden, | | | | Switzerland, Germany, France, | | | | Spain, Hungary, Italy, | | | | Yugoslavia. | | | | | ------------------------------------------------------------------------------- Table B-8. Time Zones and TZ Environment Variable Values (cont.) ------------------------------------------------------------------------------- | | | | | TZ Values | Time Zone | Geographic Area | | | | | ------------------------------------------------------------------------------- | | | | | SAST-2SADT | South Africa Standard Time, | South Africa. | | | South Africa Daylight Time. | | | | | | ------------------------------------------------------------------------------- | | | | | JST-9 | Japan Standard Time | Japan. | | | | | ------------------------------------------------------------------------------- | | | | | WST-8:00 | Australian Western Standard | Australia: Western Australia | | | Time | | | | | | ------------------------------------------------------------------------------- | | | | | CST-9:30 | Australian Central Standard | Australia: Northern | | | Time | Territory. | | | | | ------------------------------------------------------------------------------- | | | | | CST-9:30CDT | Australian Central Standard | Australia: South Australia | | | Time, Australian Central | | | | Daylight Time. | | | | | | ------------------------------------------------------------------------------- | | | | | EST-10 | Australian Eastern Standard | Australia: Queensland. | | | Time | | | | | | ------------------------------------------------------------------------------- | | | | | EST-10EDT | Australian Eastern Standard | Australia: New South Wales, | | | Time, Australian Eastern | Tasmania, Victoria. | | | Daylight Time | | | | | | ------------------------------------------------------------------------------- | | | | | NZT-12NZDT | New Zealand Standard Time, | New Zealand | | | New Zealand Daylight Time. | | | | | | ------------------------------------------------------------------------------- If TZ is not set, time assumes Eastern Standard Time (EST5EDT). The time differential is automatically adjusted for daylight savings time according to the values in the time and zone adjustment table (the file TZTAB.LIB.SYS).
NOTE Make sure your system administrator has correctly set the hardware clock. The hardware clock must be set to Greenwich Mean Time (Universal Coordinated Time or UTC) for TIME to return the correct local time.


MPE/iX 5.0 Documentation