watch.pp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1993,97 by the Free Pascal development team.
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. unit watch;
  12. interface
  13. uses DOS;
  14. function TotalTime:string;
  15. procedure StartTime;
  16. procedure EndTime;
  17. implementation
  18. var
  19. h0,m0,s0,d0 : word;
  20. h1,m1,s1,d1 : word;
  21. h,m,s,d : word;
  22. function TotalTime:String;
  23. var mm0,ss0,dd0:integer;
  24. st,temp:string;
  25. begin
  26. mm0:=m0;ss0:=s0;dd0:=d0;
  27. if d1 < d0 then begin dd0:=dd0-100;inc(ss0);end;
  28. d:=word(d1-dd0) ; str(d,temp);
  29. if d<10 then st:='0'+temp else st:=temp;
  30. st:='.'+st;
  31. if s1 < ss0 then begin ss0:=ss0-60;inc(mm0);end;
  32. s:=word(s1-ss0) ; str(s,temp);
  33. if s<10 then st:='0'+temp+st else st:=temp+st;
  34. st:=':'+st;
  35. if m1 < mm0 then begin mm0:=mm0-60;inc(h0);end;
  36. m:=word(m1-mm0) ; str(m,temp);
  37. if m<10 then st:='0'+temp+st else st:=temp+st;
  38. st:=':'+st;
  39. h:=word(h1-h0) ; str(h,temp);
  40. if h<10 then st:='0'+temp+st else st:=temp+st;
  41. TotalTime:=st;
  42. end;
  43. procedure StartTime; begin Gettime(h0,m0,s0,d0); end;
  44. procedure EndTime ; begin Gettime(h1,m1,s1,d1); end;
  45. end.
  46. {
  47. $Log$
  48. Revision 1.1.1.1 1998-03-25 11:18:41 root
  49. * Restored version
  50. Revision 1.3 1998/01/26 11:56:54 michael
  51. + Added log at the end
  52. Working file: rtl/dos/watch.pp
  53. description:
  54. ----------------------------
  55. revision 1.2
  56. date: 1997/12/01 12:15:49; author: michael; state: Exp; lines: +13 -0
  57. + added copyright reference in header.
  58. ----------------------------
  59. revision 1.1
  60. date: 1997/11/27 08:33:50; author: michael; state: Exp;
  61. Initial revision
  62. ----------------------------
  63. revision 1.1.1.1
  64. date: 1997/11/27 08:33:50; author: michael; state: Exp; lines: +0 -0
  65. FPC RTL CVS start
  66. =============================================================================
  67. }