home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!news.ans.net!cmcl2!rlgsc.com!gezelter
- From: gezelter@rlgsc.com
- Newsgroups: comp.os.vms
- Subject: Re: Anybody have time arithmetic routines?
- Message-ID: <1993Jan21.094623.335@rlgsc.com>
- Date: 21 Jan 93 09:46:22 EST
- References: <1993Jan21.020035.18787@slcs.slb.com>
- Organization: Robert Gezelter Software Consultant, Flushing, NY
- Lines: 55
-
- In article <1993Jan21.020035.18787@slcs.slb.com>, brydon@asl.slb.com (Harvey Brydon (918)250-4312) writes:
- > I have to do some reporting on some timing tests and have a need to calculate
- > elapsed times for a number of values. Is there a way to calculate this in a
- > simple fashion (DCL preferred, Fortran otherwise)? I'll be parsing the
- > timestamps from an RMS file with DCL. Before I get a league of answers about
- > calculating delta time from 'now', let me make it clear I need to calculate
- > this from two arbitrary timestamps. eg:
- >
- > $ t1 = "20-JAN-1993 08:07:09.03"
- > $ t2 = "20-JAN-1993 10:22:13.44"
- > $! (magic dcl here)
- > $ show sym diff ==> "0 02:15:04.41"
- >
- > (if my time math is correct). I would also like to be able to add some of
- > these delta times to totals:
- >
- > $ dt1 = "0 00:00:10"
- > $ dt2 = "0 00:01:15"
- > $ (more magic...)
- > $ show sym sum_dt ==> "0 00:01:25"
- >
- > Anybody have any tricks for this or is it just a matter of brute force
- > parsing, adding and carrying?
- > _______________________________________________________________
- > Harvey Brydon | Internet: brydon@dsn.SINet.slb.com
- > Dowell Schlumberger | P.O.T.S.: (918)250-4312
- > Pity the meek, for they shall inherit the earth.
- --
- Harvey,
-
- In DCL it might be a bit of a pain (I don't recall a facility
- for subtracting Quadwords).
-
- In FORTRAN, it is simple. Simply do the following:
-
- Convert start date to internal format using LIB$CONVERT_DATE_STRING
- Convert end date to internal format using LIB$CONVERT_DATE_STRING
- Use LIB$SUB_TIMES to determine the difference
- Convert difference to ASCII string using LIB$FORMAT_DATE_TIME
- (alternatively, this step can use the $FAO system service)
-
- The above is fairly simple.
-
- I hope that the above is helpful. If I have been unclear, or if
- I can be of further assistance, please feel free to contact me
- via Email or phone.
-
- - Bob
- +--------------------------------------------------------------------------+
- | Robert "Bob" Gezelter E-Mail: gezelter@rlgsc.com |
- | Robert Gezelter Software Consultant Voice: +1 718 463 1079 |
- | 35-20 167th Street, Suite 215 Fax: (on Request) |
- | Flushing, New York 11358-1731 |
- | United States of America |
- +--------------------------------------------------------------------------+
-