home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l210 / 1.ddi / EXAMPLES.ARC / CH16EX02.PRO < prev    next >
Encoding:
Prolog Source  |  1988-06-21  |  738 b   |  27 lines

  1. /*
  2.    Turbo Prolog 2.0 Chapter 16, Example Program 2
  3.    
  4.    Copyright (c) 1986, 88 by Borland International, Inc
  5.    
  6. */
  7. predicates
  8.    timer
  9.  
  10. clauses
  11.    timer:-
  12.       time(H1,M1,S1,D1),nl,
  13.       write("Start time is: ",H1,":",M1,":",S1," and ",D1,"/100 sec"),nl,
  14.       /* This is the activity that is being timed */
  15.       system("dir *.*"),
  16.       time(H2,M2,S2,D2),
  17.       Time = (D2-D1) + 100 * ((S2 - S1) + 60 * ((M2 - M1) + 60 * (H2 - H1))),
  18.       write("Elapsed time:  ",Time,"/100 sec"),nl,
  19.       time(H3,M3,S3,D3),
  20.       write("The time now is: ",H3,":",M3,":",S3," and ",D3,"/100 sec"),nl.
  21.  
  22. goal
  23.    makewindow(1,7,7," Timer ",8,10,12,60),
  24.    write("Press any key to start"),
  25.    readchar(_),
  26.    timer.
  27.