Re: [問題] 倒數計時
我把我寫的結果PO上來好了
測試很多次的結果,到百分秒這個位數上沒有差距
但我不會呼叫更寫小位數所以不知道千分秒的差距如何
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PROGRAM EE
INTEGER IHR,IMIN,ISEC,IPSEC
INTEGER RUSEC
RUSEC=1*100 !倒數1秒
CALL GETTIM(IHR,IMIN,ISEC,IPSEC)
write(*,*) IHR,IMIN,ISEC,IPSEC
CALL CountDownTime(RUSEC)
CALL GETTIM(IHR,IMIN,ISEC,IPSEC)
write(*,*) IHR,IMIN,ISEC,IPSEC
END
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SUBROUTINE CountDownTime(RUSEC)
INTEGER RUSEC
integer BE_time,AF_time
INTEGER DPSEC
INTEGER IHR,IMIN,ISEC,IPSEC
INTEGER DAY,CHECK
DAY=0
!---------------------------------------------
CALL GETTIM(IHR,IMIN,ISEC,IPSEC)
BE_time=360000*IHR+6000*IMIN+100*ISEC+IPSEC
DO WHILE (.TRUE.)
CALL GETTIM(IHR,IMIN,ISEC,IPSEC)
AF_time=360000*IHR+6000*IMIN+100*ISEC+IPSEC
IF (AF_time.GE.BE_time) CHECK=1
if (AF_time.LT.BE_time.AND.CHECK.NE.0) THEN
CHECK=0
DAY=DAY+1
END IF
AF_time=AF_time+DAY*8640000
DPSEC=AF_time-BE_time
IF (DPSEC.GE.RUSEC) EXIT
END DO
END
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.190.92
→
10/29 16:42, , 1F
10/29 16:42, 1F
→
10/29 16:46, , 2F
10/29 16:46, 2F
推
10/29 19:16, , 3F
10/29 19:16, 3F
推
10/29 21:22, , 4F
10/29 21:22, 4F
→
10/29 21:23, , 5F
10/29 21:23, 5F
討論串 (同標題文章)
Fortran 近期熱門文章
PTT數位生活區 即時熱門文章