Created a tag for the 2012 HWRF baseline tests.
[WPS-merge.git] / hwrf-baseline-20120103-1354 / ungrib / src / ngl / w3 / w3utcdat.f
blob600f573b824bda2e1abd8dc3389b5537cee7ae75
1 !-----------------------------------------------------------------------
2 subroutine w3utcdat(idat)
3 !$$$ SUBPROGRAM DOCUMENTATION BLOCK
5 ! SUBPROGRAM: W3UTCDAT RETURN THE UTC DATE AND TIME
6 ! AUTHOR: MARK IREDELL ORG: WP23 DATE: 98-01-05
8 ! ABSTRACT: THIS SUBPROGRAM RETURNS THE UTC (GREENWICH) DATE AND TIME
9 ! IN THE NCEP ABSOLUTE DATE AND TIME DATA STRUCTURE.
11 ! PROGRAM HISTORY LOG:
12 ! 98-01-05 MARK IREDELL
13 ! 1999-04-28 Gilbert - added a patch to check for the proper
14 ! UTC offset. Needed until the IBM bug
15 ! in date_and_time is fixed. The patch
16 ! can then be removed. See comments in
17 ! the section blocked with "&&&&&&&&&&&".
18 ! 1999-08-12 Gilbert - Changed so that czone variable is saved
19 ! and the system call is only done for
20 ! first invocation of this routine.
22 ! USAGE: CALL W3UTCDAT(IDAT)
24 ! OUTPUT VARIABLES:
25 ! IDAT INTEGER (8) NCEP ABSOLUTE DATE AND TIME
26 ! (YEAR, MONTH, DAY, TIME ZONE,
27 ! HOUR, MINUTE, SECOND, MILLISECOND)
29 ! SUBPROGRAMS CALLED:
30 ! DATE_AND_TIME FORTRAN 90 SYSTEM DATE INTRINSIC
31 ! IW3JDN COMPUTE JULIAN DAY NUMBER
32 ! W3FS26 YEAR, MONTH, DAY FROM JULIAN DAY NUMBER
34 ! ATTRIBUTES:
35 ! LANGUAGE: FORTRAN 90
37 !$$$
38 integer idat(8)
39 character cdate*8,ctime*10,czone*5
40 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
41 ! get local date and time but use the character time zone
42 call date_and_time(cdate,ctime,czone,idat)
43 read(czone,'(i5)') idat(4)
44 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
45 ! convert to hours and minutes to UTC time
46 ! and possibly adjust the date as well
47 idat(6)=idat(6)-mod(idat(4),100)
48 idat(5)=idat(5)-idat(4)/100
49 idat(4)=0
50 if(idat(6).lt.00) then
51 idat(6)=idat(6)+60
52 idat(5)=idat(5)-1
53 elseif(idat(6).ge.60) then
54 idat(6)=idat(6)-60
55 idat(5)=idat(5)+1
56 endif
57 if(idat(5).lt.00) then
58 idat(5)=idat(5)+24
59 jldayn=iw3jdn(idat(1),idat(2),idat(3))-1
60 call w3fs26(jldayn,idat(1),idat(2),idat(3),idaywk,idayyr)
61 elseif(idat(5).ge.24) then
62 idat(5)=idat(5)-24
63 jldayn=iw3jdn(idat(1),idat(2),idat(3))+1
64 call w3fs26(jldayn,idat(1),idat(2),idat(3),idaywk,idayyr)
65 endif
66 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
67 end