PROGRAM TSTTIM ********************************************************************** * IDENTIFICATION * * File: tsttim.ftn * Version: 1.0 * Author: Bob Thomas * History: created 8-aug-86 * ********************************************************************** * DESCRIPTION * This program is to test the subroutine for converting system * date and time to CLUNKS (a single number.) * It asks for the date and time to be converted and then converts * and reports the origonal date and time; the clunk date/time in * words and in decimal (expressed as seconds); the difference * between the current date/time and the previous date/time in * seconds; and finally the clunk return status. * * ********************************************************************** * * * Declare all variables: * Sdate and stime are the system date and time, ids is the return * status from the subroutine, i2datm is the array of 2-word integers * in which the clunk date is returned from the subroutine, ddatim is * the double precion array into which the returned words are converted, * pdx is the current clunk date, oldpdx is the previous clunk date, * and diff is the difference between the current and the previous * clunk dates. * Byte sdate(9),stime(8) Integer ids,I2datm(4) Double precision ddatim(4),dpx,olddpx,diff * * Get the system date and time and display it to show the correct form call date(sdate) call time(stime) write(7,9000)sdate,stime Type *,' ' * * Print the column headings write(7,9002) Type *,' ' * * Request the date and time for conversion 1 Write(7,9003) read(7,9001)sdate,stime * * Call the subroutine for converting the date/time into a clunk date call d2clnk(i2datm,sdate,stime,ids) * * Convert from 2-word integers to 4-word integers to * provide for the high bit being set on the integers returned * Then convert to double precision reals prior to combining them do 2 j=1,4 ddatim(j)=i2datm(j) 2 if(i2datm(j).lt.0)ddatim(j)=i2datm(j)+65536. * * Combine into a single double precision real value dpx = 0.0 do 3 j=1,4 3 dpx = dpx + (ddatim(j)*65536.**(j-1))/10000000. * * Calculate the difference between the current value and the previous diff = dpx - olddpx * * Print the results, overwriting the input line write(7,9000)sdate,stime,i2datm,dpx,diff,ids * * Save the current value olddpx = dpx * * Exit on error if (ids.lt.0) go to 999 * * Otherwise loop again go to 1 * 999 continue * * Formats 9000 Format('+',9a1,x,8a1,x,3i7,x,i4,f16.3,f12.0,i3) 9001 Format(9a1,x,8a1) 9002 Format(' Date ',4x,' Time ' 1,' Word1 2 3 4 ' 1,'Clunk Time(secs)',' Diff Stat') 9003 Format('$Enter date and time :') * end