home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / jr_tools / jrtim201.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-07-13  |  5.1 KB  |  175 lines

  1. Unit JRTIM201 ;
  2.  
  3. (*╔═════════════════════════════════════════════════════════════════════════╗*)
  4. (*║                                                                         ║*)
  5. (*║             JR Unit Library  -  Version 2.01  -  June xxrd 1988         ║*)
  6. (*║                                                                         ║*)
  7. (*║                 Internal clock functions and procedures                 ║*)
  8. (*║                                                                         ║*)
  9. (*╚═════════════════════════════════════════════════════════════════════════╝*)
  10.  
  11.  
  12. Interface
  13.  
  14. (*───────────────────────────────────────────────────────────────────────────*)
  15.  
  16. Uses Dos , JRGEN201 ;
  17.  
  18. (*───────────────────────────────────────────────────────────────────────────*)
  19.  
  20. Const  _DOSService = $21 ;
  21.  
  22. (*───────────────────────────────────────────────────────────────────────────*)
  23.  
  24. Var   _regs8086    : Registers ;
  25.  
  26. (*───────────────────────────────────────────────────────────────────────────*)
  27.  
  28. Function _Year : Integer ;
  29. Function _Month : Integer ;
  30. Function _Day : Integer ;
  31. Function _Date(_datetype : Integer) : String ;
  32. Function _WeekDay(_type : Integer) : String ;
  33. Function _Hour : Integer ;
  34. Function _Minute : Integer ;
  35. Function _Second : Integer ;
  36. Function _100th : Integer ;
  37. Function _Time : String ;
  38.  
  39. (*───────────────────────────────────────────────────────────────────────────*)
  40.  
  41. Implementation
  42.  
  43. (*───────────────────────────────────────────────────────────────────────────*)
  44.  
  45.  
  46. Function _Year ;
  47. (*  Version 1.00  *)
  48. Begin ;
  49.    _regs8086.ah:=42 ;
  50.    Intr(_DOSService,_regs8086) ;
  51.    _Year:=_regs8086.cx ;
  52. End  (* Function _Year *) ;
  53.  
  54. (*───────────────────────────────────────────────────────────────────────────*)
  55.  
  56. Function _Month ;
  57. (*  Version 1.00  *)
  58. Begin ;
  59.    _regs8086.ah:=42 ;
  60.    Intr(_DOSService,_regs8086) ;
  61.    _Month:=_regs8086.dh ;
  62. End  (* Function _Month *) ;
  63.  
  64. (*───────────────────────────────────────────────────────────────────────────*)
  65.  
  66. Function _Day ;
  67. (*  Version 1.00  *)
  68. Begin ;
  69.    _regs8086.ah:=42 ;
  70.    Intr(_DOSService,_regs8086) ;
  71.    _Day:=_regs8086.dl ;
  72. End  (* Function _Day *) ;
  73.  
  74. (*───────────────────────────────────────────────────────────────────────────*)
  75.  
  76. Function _Date ;
  77. (*  Version 1.01  *)
  78. Var  _c,_y,_m,_d,_m0,_d0 : String ;
  79.      _yr : Integer ;
  80. Begin ;
  81.    _c:='19' ; _yr:=_Year-1900 ;
  82.    Str(_yr,_y) ; Str(_Month,_m) ; Str(_Day,_d) ;
  83.    _m0:=_m ; _Fill(_m0,'0',2) ;
  84.    _d0:=_d ; _Fill(_d0,'0',2) ;
  85.    (*$V-*)
  86.    Case _datetype Of
  87.         1 : _Date:=_y+_m0+_d0 ;
  88.         2 : _Date:=_c+_y+'-'+_m0+'-'+_d0 ;
  89.         3 : _Date:=_d+'/'+_m+' -'+_y ;
  90.         4 : _Date:=_d+'/'+_m+' '+_c+_y ;
  91.         5 : _Date:=_m0+'/'+_d0+'/'+_y ;
  92.         6 : _Date:=_m0+'-'+_d0+'-'+_y ;
  93.         7 : _Date:=_m0+'-'+_d0+'-'+_c+_y ;
  94.    End ;
  95.    (*$V+*)
  96. End  (* Function _Date *) ;
  97.  
  98. (*───────────────────────────────────────────────────────────────────────────*)
  99.  
  100. Function _WeekDay ;
  101. (*  Version 1.01  *)
  102. (*  Modified 1.02 *)
  103. Type _Names = Array(.0..6,1..4.) Of String(.9.) ;
  104. Const  _WeekDayName : _Names = (('Sö','Söndag', 'Sun','Sunday'),
  105.                                 ('Må','Måndag', 'Mon','Monday'),
  106.                                 ('Ti','Tisdag', 'Tue','Tuesday'),
  107.                                 ('On','Onsdag', 'Wed','Wednesday'),
  108.                                 ('To','Torsdag','Thu','Thursday'),
  109.                                 ('Fr','Fredag', 'Fri','Friday'),
  110.                                 ('Lö','Lördag', 'Sat','Saturday')) ;
  111. Begin ;
  112.    _regs8086.ah:=42 ;
  113.    Intr(_DOSService,_regs8086) ;
  114.    _WeekDay:=_WeekDayName(._regs8086.al,_type.) ;
  115. End  (* Function _WeekDay *) ;
  116.  
  117. (*───────────────────────────────────────────────────────────────────────────*)
  118.  
  119. Function _Hour ;
  120. (*  Version 1.00  *)
  121. Begin ;
  122.    _regs8086.ah:=44 ;
  123.    Intr(_DOSService,_regs8086) ;
  124.    _Hour:=_regs8086.ch ;
  125. End  (* Function _Hour *) ;
  126.  
  127. (*───────────────────────────────────────────────────────────────────────────*)
  128.  
  129. Function _Minute ;
  130. (*  Version 1.00  *)
  131. Begin ;
  132.    _regs8086.ah:=44 ;
  133.    Intr(_DOSService,_regs8086) ;
  134.    _Minute:=_regs8086.cl ;
  135. End  (* Function _Minute *) ;
  136.  
  137. (*───────────────────────────────────────────────────────────────────────────*)
  138.  
  139. Function _Second ;
  140. (*  Version 1.00  *)
  141. Begin ;
  142.    _regs8086.ah:=44 ;
  143.    Intr(_DOSService,_regs8086) ;
  144.    _Second:=_regs8086.dh ;
  145. End  (* Function _Second *) ;
  146.  
  147. (*───────────────────────────────────────────────────────────────────────────*)
  148.  
  149. Function _100th ;
  150. (*  Version 1.00  *)
  151. Begin ;
  152.    _regs8086.ah:=44 ;
  153.    Intr(_DOSService,_regs8086) ;
  154.    _100th:=_regs8086.dl ;
  155. End  (* Function _100th *) ;
  156.  
  157. (*───────────────────────────────────────────────────────────────────────────*)
  158.  
  159. Function _Time ;
  160. (*  Version 1.01  *)
  161. Var _h,_m,_s : String ;
  162. Begin ;
  163.    Str(_Hour,_h) ; Str(_Minute,_m) ; Str(_Second,_s) ;
  164.    (*$V-*)
  165.    _Fill(_h,'0',2) ;
  166.    _Fill(_m,'0',2) ;
  167.    _Fill(_s,'0',2) ;
  168.    (*$V+*)
  169.    _Time:=_h+':'+_m+':'+_s ;
  170. End  (* Function _Time *) ;
  171.  
  172. (*───────────────────────────────────────────────────────────────────────────*)
  173.  
  174. End  (* Of Unit JRTIM201 *).
  175.