home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / vms / 21618 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  2.8 KB

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