[comp.os.vms] elapsed time in DCL

DHASKIN@CLARKU.BITNET (Denis W. Haskin/Manager/Tech Services) (08/23/87)

> Date:         21 Aug 87 16:33:21 GMT
> From:         "Donald A. Borsay" <necntc!rayssd!d2b@husc6.harvard.edu>
> Subject:      Re: Calculating Elapsed Time From DCL.
>
> In article <870805075119.03q@VLSI.JPL.NASA.GOV>
> xrjjm%scint.span@VLSI.JPL.NASA.GOV (John McMahon writes:
> >
> >Lately I have been playing with the various F$xTIME commands that DCL
> >offers and I have noticed a couple of things that either are shortcomings,
> >or more likely things I have missed somewhere.
> ...
> >My second time question is, how does one calculate a delta time between two
> >dates (also in DCL).  I am primarily concerned with the number of days
> >between two dates, but knowing how to figure it out to the second would be
> >nice.
>
> Ok, John and other Netlanders, here's a program I wipped up to assist me in
> some benchmark DCL procedures I did a while back.  Simply cut at the
> dotted line and replace all $$ with a tab (I here tabs cause some mailers
> pain).  I know this works with Fortran 4.4 and VMS 4.4.  Enjoy!!
> [...]

I missed the original posting, but agree that DCL lexical functions lack
some functionality in the realm of elapsed time and such.  For those of
you who don't have or don't wish to get involved in Fortran, here's what
I used to do some benchmarking (one could change it for more or less resolution
as necessary):

$ startelapsed = (f$cvtime(,,"HOUR")*60 + f$cvtime(,,"MINUTE")) -
        * 60+f$cvtime(,,"SECOND")
$ ! ...
$ ! do whatever needs timing in here
$ ! ...
$ elapsed = (f$cvtime(,,"HOUR")*60 + f$cvtime(,,"MINUTE"))*60 + -
        f$cvtime(,,"SECOND") - startelapsed

Note that this assumes whatever you're doing will *not* span a 24-hour period;
if so, you'd have to tack in f$cvtime(,,"DAY")*24 in the front (with the
appropriate parentheses) (and that then assumes you won't span a month).
Oh well...

% Denis W. Haskin                             Manager, Technical Services %
% ----------------------------------------------------------------------- %
% DHASKIN@CLARKU.BITNET   Office of Information Systems     (617)793-7193 %
% Clark University               950 Main Street      Worcester MA  01610 %
%                                                                         %
%                      "I did!  I did tee a puddy tat!"                   %