The TELEMAC-MASCARET system  trunk
elapse.f
Go to the documentation of this file.
1 ! *****************
2  SUBROUTINE elapse
3 ! *****************
4 !
5  &(tdeb,tfin)
6 !
7 !***********************************************************************
8 ! BIEF V6P1 21/08/2010
9 !***********************************************************************
10 !
11 !brief PRINTS THE DURATION BETWEEN TWO TIMES GIVEN BY THE
12 !+ CALL TO DATE_AND_TIME.
13 !
14 !history J-M HERVOUET (LNHE)
15 !+ 20/09/2001
16 !+ V5P3
17 !+
18 !
19 !history N.DURAND (HRW), S.E.BOURBAN (HRW)
20 !+ 13/07/2010
21 !+ V6P0
22 !+ Translation of French comments within the FORTRAN sources into
23 !+ English comments
24 !
25 !history N.DURAND (HRW), S.E.BOURBAN (HRW)
26 !+ 21/08/2010
27 !+ V6P0
28 !+ Creation of DOXYGEN tags for automated documentation and
29 !+ cross-referencing of the FORTRAN sources
30 !
31 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 !| TDEB |-->| TIME OF BEGINNING
33 !| TFIN |-->| TIME OF END
34 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35 !
37  IMPLICIT NONE
38 !
39 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
40 !
41  INTEGER, INTENT(IN) :: TDEB(8),TFIN(8)
42 !
43 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
44 !
45  INTEGER YEAR,MONTH,DAY,NDAY,J1,J2,HOURS,MINUTES
46  INTEGER Y,M
47  DOUBLE PRECISION TD,TF,TT
48 !
49  INTRINSIC int
50 !
51  INTEGER, PARAMETER :: GREG=15+31*(10+12*1582)
52 !
53 !-----------------------------------------------------------------------
54 !
55 ! COMPUTES THE NUMBER OF DAYS (USES THE JULIAN DAY SYSTEM)
56 !
57  year=tdeb(1)
58  month=tdeb(2)
59  day=tdeb(3)
60  IF(month.GT.2) THEN
61  y=year
62  m=month+1
63  ELSE
64  y=year-1
65  m=month+13
66  ENDIF
67 !
68  j1=int(365.25d0*y)+int(30.6001d0*m)+day+1720995
69  IF(day+31*(month+12*year).GE.greg) THEN
70  j1=j1+2-int(0.01d0*y)+int(0.25d0*int(0.01d0*y))
71  ENDIF
72 !
73  year=tfin(1)
74  month=tfin(2)
75  day=tfin(3)
76  IF(month.GT.2) THEN
77  y=year
78  m=month+1
79  ELSE
80  y=year-1
81  m=month+13
82  ENDIF
83 !
84  j2=int(365.25d0*y)+int(30.6001d0*m)+day+1720995
85  IF(day+31*(month+12*year).GE.greg) THEN
86  j2=j2+2-int(0.01d0*y)+int(0.25d0*int(0.01d0*y))
87  ENDIF
88 !
89  nday=j2-j1
90 !
91  td = 3600.d0*tdeb(5) + 60.d0*tdeb(6) + tdeb(7)
92  tf = 3600.d0*tfin(5) + 60.d0*tfin(6) + tfin(7)
93  IF(tf.LT.td) THEN
94  nday=nday-1
95  tf=tf+86400.d0
96  ENDIF
97  tt=tf-td
98  hours=int(tt/3600.d0)
99  tt=tt-3600.d0*hours
100  minutes=int(tt/60.d0)
101  tt=tt-60.d0*minutes
102 !
103 !---------------------------------------------------------------------
104 !
105  WRITE(lu,*) 'ELAPSE TIME : '
106  IF(nday.GT.0) THEN
107  WRITE(lu,*) ' ',nday,' DAYS'
108  ENDIF
109  IF(hours.GT.0) THEN
110  WRITE(lu,*) ' ',hours,' HOURS'
111  ENDIF
112  IF(minutes.GT.0) THEN
113  WRITE(lu,*) ' ',minutes,' MINUTES'
114  ENDIF
115  WRITE(lu,*) ' ',int(tt),' SECONDS'
116 !
117 !---------------------------------------------------------------------
118 !
119  RETURN
120  END
subroutine elapse(TDEB, TFIN)
Definition: elapse.f:7