Update the g2 and w3 libraries to the latest NCEP versions
[WPS.git] / ungrib / src / ngl / w3 / w3difdat.f
blob1e76b6e78fbf2dac284e4def2a1bf7d9feddf74a
1 !-----------------------------------------------------------------------
2 subroutine w3difdat(jdat,idat,it,rinc)
3 !$$$ SUBPROGRAM DOCUMENTATION BLOCK
5 ! SUBPROGRAM: W3DIFDAT RETURN A TIME INTERVAL BETWEEN TWO DATES
6 ! AUTHOR: MARK IREDELL ORG: WP23 DATE: 98-01-05
8 ! ABSTRACT: THIS SUBPROGRAM RETURNS THE ELAPSED TIME INTERVAL FROM
9 ! AN NCEP ABSOLUTE DATE AND TIME GIVEN IN THE SECOND ARGUMENT UNTIL
10 ! AN NCEP ABSOLUTE DATE AND TIME GIVEN IN THE FIRST ARGUMENT.
11 ! THE OUTPUT TIME INTERVAL IS IN ONE OF SEVEN CANONICAL FORMS
12 ! OF THE NCEP RELATIVE TIME INTERVAL DATA STRUCTURE.
14 ! PROGRAM HISTORY LOG:
15 ! 98-01-05 MARK IREDELL
17 ! USAGE: CALL W3DIFDAT(JDAT,IDAT,IT,RINC)
19 ! INPUT VARIABLES:
20 ! JDAT INTEGER (8) NCEP ABSOLUTE DATE AND TIME
21 ! (YEAR, MONTH, DAY, TIME ZONE,
22 ! HOUR, MINUTE, SECOND, MILLISECOND)
23 ! IDAT INTEGER (8) NCEP ABSOLUTE DATE AND TIME
24 ! (YEAR, MONTH, DAY, TIME ZONE,
25 ! HOUR, MINUTE, SECOND, MILLISECOND)
26 ! IT INTEGER RELATIVE TIME INTERVAL FORMAT TYPE
27 ! (-1 FOR FIRST REDUCED TYPE (HOURS ALWAYS POSITIVE),
28 ! 0 FOR SECOND REDUCED TYPE (HOURS CAN BE NEGATIVE),
29 ! 1 FOR DAYS ONLY, 2 FOR HOURS ONLY, 3 FOR MINUTES ONLY,
30 ! 4 FOR SECONDS ONLY, 5 FOR MILLISECONDS ONLY)
32 ! OUTPUT VARIABLES:
33 ! RINC REAL (5) NCEP RELATIVE TIME INTERVAL
34 ! (DAYS, HOURS, MINUTES, SECONDS, MILLISECONDS)
35 ! (TIME INTERVAL IS POSITIVE IF JDAT IS LATER THAN IDAT.)
37 ! SUBPROGRAMS CALLED:
38 ! IW3JDN COMPUTE JULIAN DAY NUMBER
39 ! W3REDDAT REDUCE A TIME INTERVAL TO A CANONICAL FORM
41 ! ATTRIBUTES:
42 ! LANGUAGE: FORTRAN 90
44 !$$$
45 integer jdat(8),idat(8)
46 real rinc(5)
47 real rinc1(5)
48 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
49 ! difference the days and time and put into canonical form
50 rinc1(1)=iw3jdn(jdat(1),jdat(2),jdat(3))-
51 & iw3jdn(idat(1),idat(2),idat(3))
52 rinc1(2:5)=jdat(5:8)-idat(5:8)
53 call w3reddat(it,rinc1,rinc)
54 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
55 end