.TITLE GTTIMD .IDENT /V01/ .ENABLE LC .MCALL GTIM$S ; ; This module forms part of the suite of Time Routines returning the ; current date in one of the following forms, or converting one form to ; another. ; Form I - Hours, Minutes, Seconds & Tenths of a Second ; Form A - ASCII HH:MM:SS.S ; Form D - Integer*4 seconds since midnight ; ; Author: V01 15-Jul-80 Phil Stephensen-Payne ; ; Calling Sequence: ; ; This subroutine is called via the standard FORTRAN calling sequence as: ; ; CALL GTTIMD (ISECS [,STATUS]) ; or ; STATUS = GTTIMD (ISECS) ; ; or ; CALL GTTIMD from MACRO-11 with ; R5 = 0 ; R1 = Address of ISECS ; R0 = STATUS on output ; ; Where: ; ISECS = Integer*4 number of second since midnight ; STATUS = Optional error return ; ; Errors returned: ; ; STATUS = 0 if the operation was successful ; = -1 if a parameter error was detected ; ; External references: ; ; This module calls the subroutines PRMCHK ; ; BUF: .BLKW 8. ; Buffer for GTIM$S ; ; GTTIMD:: TST R5 ; Called directly from MACRO-11? BEQ 10$ ; If eq yes - omit PRMCHK ; ; Specify number of parameters including error return. R5 not affected. ; MOV #2,R0 ; Check Number of Parameters CALL PRMCHK ; BCS END ; If CS parameter error - exit at once TST (R5)+ ; Ignore number of parameters MOV (R5)+,R1 ; Get Address for Output ; 10$: BIT #1,R1 ; Output word-aligned? BNE ERR ; If NE no - parameter error MOV R1,R2 ; Shift address to another register GTIM$S #BUF ; Get the date MOV BUF+6,R1 ; Get the hours MUL #60.,R1 ; Convert to minutes ADD BUF+8.,R1 ; Add the minutes MOV R1,R0 ; Shift to high register MUL #60.,R0 ; Multiply again ADD BUF+10.,R1 ; Add the seconds ADC R0 ; Add the carry just in case MOV R1,(R2)+ ; Return the value MOV R0,(R2)+ ; CLR R0 ; Show success ; END: RETURN ; ERR: MOV #-1,R0 ; Error RETURN .END