home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / CLOCKSTP.ZIP / CLOCKS.DOC < prev    next >
Encoding:
Text File  |  1989-07-23  |  4.1 KB  |  87 lines

  1.                                 CLOCKS:
  2.                    CMOS/DOS Real-Time Clock Object
  3.              and REXX-like Date/Time Formatting Functions
  4.                           in Turbo Pascal 5.5
  5.  
  6.                                   by
  7.  
  8.                              Earl F. Glynn
  9.                            Overland Park, KS
  10.                          Compuserve 73257,3527
  11.  
  12.  
  13. Clock objects can be used as individual timers, using either the CMOS
  14. real-time clock, or the DOS real-time clock.  As shown in the ClkDemo
  15. PROGRAM, the DOS clock can be shut off when interrupts are disabled.
  16. The precision of the CMOS clock is only 1 second, while the DOS clock
  17. has 0.0549 second resolution (18.203 ticks per second).  In addition
  18. to real-time clocks, static time stamps can be manipulated and
  19. formatted.  The range for all clocks and time stamps is January 1, 1900
  20. through June 5, 2079.  (September 18, 1989 is the midpoint of this range).
  21.  
  22. Several REXX-like FUNCTIONs provide Date/Time formatting.  [REXX,
  23. the Restructured Extended Executor, or sometimes called the System Product
  24. Interpreter, is IBM's SAA command language (now primarily for VM/CMS).
  25. That is, REXX EXECs are CMS's equivalent of PC .BAT files but REXX
  26. provides much more functionality than the PC 'BAT' language.]
  27.  
  28. REXX-like FUNCTIONS in Pascal could be considered an oxymoron since
  29. REXX doesn't have any concept of TYPEd variables and obviously Pascal does.
  30. The Pascal functions in most cases were written to return STRINGs,
  31. which is similar to REXX.  In some cases, where a number was returned
  32. that could be used in calculations, a separate function was used.  For
  33. example, the REXX TIME('Elapsed') function was implemented as an object
  34. 'Elapsed' method that returns a REAL value to be used in calculations.
  35. A function 'hhmmss' can be used to format elapsed seconds in a
  36. character string, if desired.
  37.  
  38. The REXX 'Date' and 'Time' functions are only defined for the current
  39. date and time.  To allow flexibility in printing time stamps, such as
  40. a file's time stamp, 'DateFormat' and 'TimeFormat' were written.
  41.  
  42. Once a real-time clock is started with its 'Start' method, the 'Date'
  43. and 'Time' methods return this start time.  The 'Elapsed' method
  44. returns the real-time clock value in seconds.  'Start' must be called
  45. to update 'Date' and 'Time' values.
  46.  
  47. CMOS and DOS clocks should be calibrated against a known, reliable time
  48. source such as the National Bureau of Standards WWV time standard (available
  49. via phone or shortwave radio).  A correction factor could be added
  50. to the 'Elapsed' method, if necessary.  (Note the clocks have 'precision'
  51. but not necessarily 'accuracy' -- something I have not seen addressed
  52. in the microsecond timers on microcomputers).
  53.  
  54. See the CLKDEMO.PAS, FLOPS.PAS and TIMER.PAS programs for sample usage
  55. of clock objects and this UNIT.
  56.  
  57.  
  58.  
  59.     File                         D e s c r i p t i o n
  60. ------------  ----------------------------------------------------------
  61. CLOCKS.DOC    This file.
  62. CLOCKS.PAS    Real-time clock object and REXX-like formatting functions.
  63.               Methods:  Date,Time,Start,Elapsed.  Functions/Procedures:
  64.               DateFormat,DaysThisCentury,hhmmss,JulianDate,SetClock,
  65.               TimeDiff,TimeFormat,UnPackTime
  66. CLOCKS.TPU    Compiled CLOCKS Turbo Pascal UNIT.
  67.  
  68. CLKDEMO.PAS   Examples of how the CLOCKS UNIT can be used.
  69. CLKDEMO.EXE   Compiled form of CLKDEMO.PAS
  70. CLKDEMO.OUT   Output:  CLKDEMO > CLKDEMO.OUT
  71.                 CMOS/DOS Clock Differences
  72.                 Date/DateFormat Examples
  73.                 Time/TimeFormat Examples
  74.                 Time Differences/Elapsed Time
  75.                 Clocks.UnPackTime
  76.  
  77. FLOPS.PAS     Floating-Point Operations Per Second (FLOPS) Benchmark
  78.                 with REAL matrices > 65535 bytes in size
  79. FLOPS.EXE     Compiled form of FLOPS.PAS
  80. DELL220.FLP   FLOPS output from Dell 220
  81. TOSH3100.FLP  FLOPS output from Toshiba 3100
  82.  
  83. TIMER.PAS     Time any program execution from native DOS or from a BAT file
  84. TIMER.EXE     Compiled form of TIMER.PAS
  85. TMRDEMO.BAT   Example of how to use TIMER from a BAT file.
  86. TIMER.LOG     Output timer log from TMRDEMO.BAT example
  87.