Contents of the CLOCKS.DOC file
CMOS/DOS Real-Time Clock Object
and REXX-like Date/Time Formatting Functions
in Turbo Pascal 5.5
Earl F. Glynn
Overland Park, KS
Clock objects can be used as individual timers, using either the CMOS
real-time clock, or the DOS real-time clock. As shown in the ClkDemo
PROGRAM, the DOS clock can be shut off when interrupts are disabled.
The precision of the CMOS clock is only 1 second, while the DOS clock
has 0.0549 second resolution (18.203 ticks per second). In addition
to real-time clocks, static time stamps can be manipulated and
formatted. The range for all clocks and time stamps is January 1, 1900
through June 5, 2079. (September 18, 1989 is the midpoint of this range).
Several REXX-like FUNCTIONs provide Date/Time formatting. [REXX,
the Restructured Extended Executor, or sometimes called the System Product
Interpreter, is IBM's SAA command language (now primarily for VM/CMS).
That is, REXX EXECs are CMS's equivalent of PC .BAT files but REXX
provides much more functionality than the PC 'BAT' language.]
REXX-like FUNCTIONS in Pascal could be considered an oxymoron since
REXX doesn't have any concept of TYPEd variables and obviously Pascal does.
The Pascal functions in most cases were written to return STRINGs,
which is similar to REXX. In some cases, where a number was returned
that could be used in calculations, a separate function was used. For
example, the REXX TIME('Elapsed') function was implemented as an object
'Elapsed' method that returns a REAL value to be used in calculations.
A function 'hhmmss' can be used to format elapsed seconds in a
character string, if desired.
The REXX 'Date' and 'Time' functions are only defined for the current
date and time. To allow flexibility in printing time stamps, such as
a file's time stamp, 'DateFormat' and 'TimeFormat' were written.
Once a real-time clock is started with its 'Start' method, the 'Date'
and 'Time' methods return this start time. The 'Elapsed' method
returns the real-time clock value in seconds. 'Start' must be called
to update 'Date' and 'Time' values.
CMOS and DOS clocks should be calibrated against a known, reliable time
source such as the National Bureau of Standards WWV time standard (available
via phone or shortwave radio). A correction factor could be added
to the 'Elapsed' method, if necessary. (Note the clocks have 'precision'
but not necessarily 'accuracy' -- something I have not seen addressed
in the microsecond timers on microcomputers).
See the CLKDEMO.PAS, FLOPS.PAS and TIMER.PAS programs for sample usage
of clock objects and this UNIT.
File D e s c r i p t i o n
CLOCKS.DOC This file.
CLOCKS.PAS Real-time clock object and REXX-like formatting functions.
Methods: Date,Time,Start,Elapsed. Functions/Procedures:
CLOCKS.TPU Compiled CLOCKS Turbo Pascal UNIT.
CLKDEMO.PAS Examples of how the CLOCKS UNIT can be used.
CLKDEMO.EXE Compiled form of CLKDEMO.PAS
CLKDEMO.OUT Output: CLKDEMO > CLKDEMO.OUT
CMOS/DOS Clock Differences
Time Differences/Elapsed Time
FLOPS.PAS Floating-Point Operations Per Second (FLOPS) Benchmark
with REAL matrices > 65535 bytes in size
FLOPS.EXE Compiled form of FLOPS.PAS
DELL220.FLP FLOPS output from Dell 220
TOSH3100.FLP FLOPS output from Toshiba 3100
TIMER.PAS Time any program execution from native DOS or from a BAT file
TIMER.EXE Compiled form of TIMER.PAS
TMRDEMO.BAT Example of how to use TIMER from a BAT file.
TIMER.LOG Output timer log from TMRDEMO.BAT example