PRCTTI ;WISC@ALTOONA/RGY-CALCULATE TIME ;01 Jun 90/3:26 PM
;;5.1;IFCAP;;Oct 20, 2000
;Per VHA Directive 10-93-142, this routine should not be modified.
;PRCTMIN=# of min. to add or sub, PRCTSD=date to add or sub from in FM format -- Answer ret. in 'Y'
S X2=PRCTMIN\1440,HOUR=(PRCTMIN-(1440*X2))\60,MIN=(PRCTMIN-(1440*X2)-(60*HOUR))#$S(PRCTMIN<0:-60,1:60),X1=PRCTSD\1,HR=$E(PRCTSD,9,10),MI=$E(PRCTSD,11,12)
S:$L(HR)=1 HR=HR_0 S:$L(MI)=1 MI=MI_0 S MI=MI+MIN S:MI>59 MI=MI-60,HR=HR+1
S:MI<0 MI=MI+60,HR=HR-1 S HR=HR+HOUR S:HR>23 HR=HR-24,X2=X2+1 S:HR<0 HR=HR+24,X2=X2-1 S:HR+MI=0 X2=X2-1,HR=24,MI=0 S:HR<10 HR=0_HR S:MI<10 MI=0_MI S X=X1 D:X2 C^%DTC S X=$P(X,".") S Y=+(X_"."_HR_MI)
; install with verson 17.3 of fm
K HR,MI,X1,X2,HOUR,MIN,PRCTMIN,O Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRCTTI 765 printed Dec 13, 2024@02:19:27 Page 2
PRCTTI ;WISC@ALTOONA/RGY-CALCULATE TIME ;01 Jun 90/3:26 PM
+1 ;;5.1;IFCAP;;Oct 20, 2000
+2 ;Per VHA Directive 10-93-142, this routine should not be modified.
+3 ;PRCTMIN=# of min. to add or sub, PRCTSD=date to add or sub from in FM format -- Answer ret. in 'Y'
+4 SET X2=PRCTMIN\1440
SET HOUR=(PRCTMIN-(1440*X2))\60
SET MIN=(PRCTMIN-(1440*X2)-(60*HOUR))#$SELECT(PRCTMIN<0:-60,1:60)
SET X1=PRCTSD\1
SET HR=$EXTRACT(PRCTSD,9,10)
SET MI=$EXTRACT(PRCTSD,11,12)
+5 if $LENGTH(HR)=1
SET HR=HR_0
if $LENGTH(MI)=1
SET MI=MI_0
SET MI=MI+MIN
if MI>59
SET MI=MI-60
SET HR=HR+1
+6 if MI<0
SET MI=MI+60
SET HR=HR-1
SET HR=HR+HOUR
if HR>23
SET HR=HR-24
SET X2=X2+1
if HR<0
SET HR=HR+24
SET X2=X2-1
if HR+MI=0
SET X2=X2-1
SET HR=24
SET MI=0
if HR<10
SET HR=0_HR
if MI<10
SET MI=0_MI
SET X=X1
if X2
DO C^%DTC
SET X=$PIECE(X,".")
SET Y=+(X_"."_HR_MI)
+7 ; install with verson 17.3 of fm
+8 KILL HR,MI,X1,X2,HOUR,MIN,PRCTMIN,O
QUIT