;*********************************** ; ; DAYTIM - return date and time ; ;*********************************** ;1.0 15-Jan-84 DFP written by D. Pallmann ; ; Calling Format: XCALL DAYTIM, D$, T$ ; ; Where: D$ = 8-byte string variable to receive current date ; T$ = 8-byte string variable to receive current time ; ; Date is returned in the format "mm/dd/yy" ; Time is returned in the format "hh:mm xM" VMAJOR=1 OBJNAM DAYTIM.SBR SEARCH SYS SEARCH SYSSYM COPY XCALL START: PHDR -1,0,PH$REE!PH$REU ;program header DATE: GDATES @A4 ;get the date MOV XC.AD1(A3),A2 ;A2 := index to D$ CLR D1 ;clear D1 MOVB @A4,D1 ;D1 := month DCVT 2,OT$MEM ;store month in D$ MOVB #'/,(A2)+ ;append "/" to D$ MOVB 1(A4),D1 ;D1 := day DCVT 2,OT$MEM ;append day to D$ MOVB #'/,(A2)+ ;append "/" to D$ MOVB 2(A4),D1 ;D1 := year DCVT 2,OT$MEM ;append year to D$ TIME: GTIMES @A4 ;get the time MOV XC.AD2(A3),A2 ;A2 := index to T$ MOVB @A4,D1 ;D1 := hours CLRW D2 ;clear D2 (AM/PM flag) CMPB D1,#12. ;is the hour>12 noon? BLE 10$ ; no SUBW #12.,D1 ; yes - adjust for 12 hour time SETW D2 ; and set PM flag 10$: DCVT 2,OT$MEM!OT$ZER ;store hours in T$ MOVB #':,(A2)+ ;append ":" to T$ MOVB 1(A4),D1 ;D1 := minutes DCVT 2,OT$MEM ;append minutes to T$ MOVB #40,(A2)+ ;append space to T$ MOVB #'A,D1 ;D1 := "A" TSTW D2 ;AM or PM? BEQ 20$ ; AM MOVB #'P,D1 ;D1 := "P" 20$: MOVB D1,(A2)+ ;append D1 to T$ MOVB #'M,(A2)+ ;append "M" to T$ RTN ;return to program END .