* REFERENCE PROGRAM SHOWING TIMING ROUTINES *

Program Test;

{$I TIMER07.PAS}

{  The following example shows how to include code in your
program to print the current date and time in your program output. 
The first command, which appears immediately after your Program
header, is a so-called compiler directive which tells the
compiler to include the contents of the file TIMER07.PAS in your
program code at compile time.  The contents of this file contain
numerous details about capturing the date and time, and can be
hidden in this "include file."  You may copy this file off the
network server onto your A: disk, where it should reside so the
compiler can find it when needed.  To get the date and time, you
must use the lines of code shown in the example: 

Getdate(yr, mo, day, dow) and GetTime(hr, min, sec, hund)

which are obviously calls to built-in procedures in Turbo Pascal
V7.  The include file TIMER07.PAS contains all the necessary
"hardware" to make these calls work.  The Writeln statements
output the date and time in "pretty" format; you can re-direct
the output to a file by the usual method of using a Text file
identifier in your Writeln statements.  One technical detail--the
file TIMER07.PAS contains the statement Uses Crt, Dos; so the
program code for this example does not need to declare a Uses
statement.

WINDOWS USERS:  LOOK AT THE TIMER07.PAS CODE TO SEE HOW TO CHANGE
IT IF YOU ARE USING TURBO PASCAL FOR WINDOWS }

Begin
  Clrscr;
  GetDate(yr, mo, day, dow);
  Writeln('Today is ', days[dow],', ',
          mo :0, '/', day :0, '/', yr :0);
  GetTime(hr, min, sec, hund);
  Writeln('It is now ', LeadingZero(hr),':',
          LeadingZero(min),':', LeadingZero(sec),
          '.', LeadingZero(hund));
  Readln
End.

==============================================================
Below is the output when the above program is run:
Today is Sunday, 6/14/1998
It is now 20:19:55.74

==============================================================

Back to: [Home Page]