C+ C NAME: C Time2System C PURPOSE: C Retrieve system time using intrinsic IDATE and ITIME functions C CATEGORY: C gen/for/os C CALLING SEQUENCE: subroutine Time2System(tt) !use ifport ! Needed for Intel 9.1 compiler C INPUTS: ! (not for 10.0 compiler anymore) C (none) C OUTPUTS: C tt(2) integer system time C CALLS: C get_compiler, IDATE, ITIME, Time2HMS, Time2YMD C PROCEDURE: C Calls system functions IDATE and ITIME C This is available on all Fortran compilers we used so far C (with various quirks), except for gfortran 4.0.0 and earlier. C For gfortran the C file href=gnu_intrinsic= contains C-versions C for IDATE and ITIME. Linking this file should fix that. C MODIFICATION HISTORY: C JUL-2005, Paul Hick (UCSD/CASS) C DEC-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C The Intel 9.1 compiler needs the statement C use ifport C following the subroutine declaration above. C- integer tt(2) character f77id*25 integer dmy(3) integer hms3(3) integer hms4(4) equivalence (hms3,hms4) call IDATE(dmy) call ITIME(hms3) hms4(4) = 0 call get_compiler(f77id) if (index(f77id,'_pgi') .ne. 0) then ! PGI returns month first, day of month second i = dmy(1) ! Swap day of month into first place dmy(1) = dmy(2) dmy(2) = i end if ! The Intel 6.0 compiler seems to put the day of month in dmy(1) ! while setting dmy(2)=dmy(3)=0 ! The Intel 8.1 and PGI compilers sets dmy(3) to a two-digit year if (dmy(2) .eq. 0 .and. dmy(3) .eq. 0) then dmy(2) = dmy(1) ! Fix for Intel 6.0 dmy(1) = 1 dmy(3) = 2004 write (*,'(A,I4,2(A,I2))') 'OSSystemTime: returning bogus system time ',dmy(3),'/',dmy(2),'/',dmy(1) else if (dmy(3) .lt. 100) then ! Fix for Intel 8.1 and PGI dmy(3) = dmy(3)+2000 end if call Time2HMS(1,tt,hms4) ! Time of day tt(1) = tt(1)+dmy(1) ! Add days of month call Time2YMD(1,tt,dmy(3),dmy(2),tt) return end