home *** CD-ROM | disk | FTP | other *** search
- Unit JRTIM201 ;
-
- (*╔═════════════════════════════════════════════════════════════════════════╗*)
- (*║ ║*)
- (*║ JR Unit Library - Version 2.01 - June xxrd 1988 ║*)
- (*║ ║*)
- (*║ Internal clock functions and procedures ║*)
- (*║ ║*)
- (*╚═════════════════════════════════════════════════════════════════════════╝*)
-
-
- Interface
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- Uses Dos , JRGEN201 ;
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- Const _DOSService = $21 ;
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- Var _regs8086 : Registers ;
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- Function _Year : Integer ;
- Function _Month : Integer ;
- Function _Day : Integer ;
- Function _Date(_datetype : Integer) : String ;
- Function _WeekDay(_type : Integer) : String ;
- Function _Hour : Integer ;
- Function _Minute : Integer ;
- Function _Second : Integer ;
- Function _100th : Integer ;
- Function _Time : String ;
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- Implementation
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
-
- Function _Year ;
- (* Version 1.00 *)
- Begin ;
- _regs8086.ah:=42 ;
- Intr(_DOSService,_regs8086) ;
- _Year:=_regs8086.cx ;
- End (* Function _Year *) ;
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- Function _Month ;
- (* Version 1.00 *)
- Begin ;
- _regs8086.ah:=42 ;
- Intr(_DOSService,_regs8086) ;
- _Month:=_regs8086.dh ;
- End (* Function _Month *) ;
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- Function _Day ;
- (* Version 1.00 *)
- Begin ;
- _regs8086.ah:=42 ;
- Intr(_DOSService,_regs8086) ;
- _Day:=_regs8086.dl ;
- End (* Function _Day *) ;
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- Function _Date ;
- (* Version 1.01 *)
- Var _c,_y,_m,_d,_m0,_d0 : String ;
- _yr : Integer ;
- Begin ;
- _c:='19' ; _yr:=_Year-1900 ;
- Str(_yr,_y) ; Str(_Month,_m) ; Str(_Day,_d) ;
- _m0:=_m ; _Fill(_m0,'0',2) ;
- _d0:=_d ; _Fill(_d0,'0',2) ;
- (*$V-*)
- Case _datetype Of
- 1 : _Date:=_y+_m0+_d0 ;
- 2 : _Date:=_c+_y+'-'+_m0+'-'+_d0 ;
- 3 : _Date:=_d+'/'+_m+' -'+_y ;
- 4 : _Date:=_d+'/'+_m+' '+_c+_y ;
- 5 : _Date:=_m0+'/'+_d0+'/'+_y ;
- 6 : _Date:=_m0+'-'+_d0+'-'+_y ;
- 7 : _Date:=_m0+'-'+_d0+'-'+_c+_y ;
- End ;
- (*$V+*)
- End (* Function _Date *) ;
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- Function _WeekDay ;
- (* Version 1.01 *)
- (* Modified 1.02 *)
- Type _Names = Array(.0..6,1..4.) Of String(.9.) ;
- Const _WeekDayName : _Names = (('Sö','Söndag', 'Sun','Sunday'),
- ('Må','Måndag', 'Mon','Monday'),
- ('Ti','Tisdag', 'Tue','Tuesday'),
- ('On','Onsdag', 'Wed','Wednesday'),
- ('To','Torsdag','Thu','Thursday'),
- ('Fr','Fredag', 'Fri','Friday'),
- ('Lö','Lördag', 'Sat','Saturday')) ;
- Begin ;
- _regs8086.ah:=42 ;
- Intr(_DOSService,_regs8086) ;
- _WeekDay:=_WeekDayName(._regs8086.al,_type.) ;
- End (* Function _WeekDay *) ;
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- Function _Hour ;
- (* Version 1.00 *)
- Begin ;
- _regs8086.ah:=44 ;
- Intr(_DOSService,_regs8086) ;
- _Hour:=_regs8086.ch ;
- End (* Function _Hour *) ;
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- Function _Minute ;
- (* Version 1.00 *)
- Begin ;
- _regs8086.ah:=44 ;
- Intr(_DOSService,_regs8086) ;
- _Minute:=_regs8086.cl ;
- End (* Function _Minute *) ;
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- Function _Second ;
- (* Version 1.00 *)
- Begin ;
- _regs8086.ah:=44 ;
- Intr(_DOSService,_regs8086) ;
- _Second:=_regs8086.dh ;
- End (* Function _Second *) ;
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- Function _100th ;
- (* Version 1.00 *)
- Begin ;
- _regs8086.ah:=44 ;
- Intr(_DOSService,_regs8086) ;
- _100th:=_regs8086.dl ;
- End (* Function _100th *) ;
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- Function _Time ;
- (* Version 1.01 *)
- Var _h,_m,_s : String ;
- Begin ;
- Str(_Hour,_h) ; Str(_Minute,_m) ; Str(_Second,_s) ;
- (*$V-*)
- _Fill(_h,'0',2) ;
- _Fill(_m,'0',2) ;
- _Fill(_s,'0',2) ;
- (*$V+*)
- _Time:=_h+':'+_m+':'+_s ;
- End (* Function _Time *) ;
-
- (*───────────────────────────────────────────────────────────────────────────*)
-
- End (* Of Unit JRTIM201 *).
-