I often want to know how long a program runs. Some of the programs run over night and I came up with a neat calculation for determining elapsed time of a program.
U2 Code:ELAPSED = OCONV(((DATE()-@DATE)*8400)+(TIME()-@TIME),"MTS")
R83 Code:START.DATE = DATE()
START.TIME = TIME()
ELAPSED = OCONV(((DATE()-START.DATE)*8400)+(TIME()-START.TIME),"MTS")
This will take into consideration the change in date for overnight runs. It uses the @-variables @DATE and @TIME to give the program execution starting date and time. The DATE() and TIME() functions return the current date and time information. Lastly the number of days is multiplied by 86400 which is the number of seconds in a 24-hour period.
Jon A. Kristofferson