C+ C NAME: C Time2Time C PURPOSE: C Converts time from JST to UT C CATEGORY: C user/phick/for/main C CALLING SEQUENCE: program Time2Time C echo Wed, 26 Nov 2003 00:01:39 +0900 (JST) | time2time -email C INPUTS: C The line piped into Time2Time is a time in the form C Wed, 26 Nov 2003 00:01:39 +0900 C OUTPUTS: C Time string in form 2003/11/26 15:01:39 C i.e. the input time converted to UT. C INCLUDE: include 'fortime.h' C CALLS: C ForeignArg, LocFirst, Time2SetOriginInJD, Time2Day8 C Time2Split, Time2Add, Time2Str, Time2HMS, Time2Add, itrim C PROCEDURE: C MODIFICATION HISTORY: C NOV-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- character cRec*40 integer t3(3) /2440000,0,TIME__MSEC_IN_DAY/ integer t2(2) integer dt(2) /0,0/ integer hms(4) /4*0/ real*8 JD character cVar(3)*50 character cArg*50 character cTemplate*50 integer Time2Str read (*,'(A)',iostat=I) cRec cVar(1) = 'quiet' iVar = 3 call ForeignArg(' ', iVar, cVar, cArg) if (LocFirst('-reverse',cArg) .eq. 0) then nOff = +1 else nOff = -1 end if if (LocFirst('-noaa',cArg) .ne. 0) then nZone = 12 read (cRec(nZone:nZone+4),'(I5)') hms(1) ! +0900 for JST call Time2SetOriginInJD(t3) ! Set origin to JD=2440000.0 read (cRec,'(F10.4)') JD ! # days since JD=2440000.0 call Time2Day8(1,t2,JD) else if (LocFirst('-email',cArg) .ne. 0) then cTemplate = ' DD MON YYYY hh:mm:ss' if (cRec(7:7) .eq. ' ') cTemplate = ' DD MON YYYY hh:mm:ss' else if (iVar .eq. 0) then cTemplate = 'YYYY/MN/DD hh:mm:ss' else cTemplate = cVar(1) end if nZone = itrim(cTemplate)+2 if (nZone+4 .le. itrim(cRec)) read (cRec(nZone:nZone+4),'(I5)') hms(1) ! +0900 for JST call Time2Split(cTemplate,cRec,t2) end if hms(1) = -nOff*hms(1)/100 ! # hours call Time2HMS(1,dt,hms) call Time2Add(t2,dt,t2) I = Time2Str('YYYY/MN/DD hh:mm:ss',t2,cRec) write (*,'(A)') cRec(:itrim(cRec)) end