! call gitime(int vect(8)) !get present time ! returns vector of: 1-8= sec min hr day mo yr day_of_yr, day_of_wk(sun=1) subroutine gitime(vect) implicit none integer vect(8),vv(8),sin1900,y1900,c100,c400 integer mol(12),mad(12),jul,i,j,ladd logical leapnow,L400 real:: day_sec common /gitime_com/ day_sec !didn't want to change vect length ! j f m a m j j a s o n ! 31 28 31 30 31 30 31 31 30 31 30 data mad/0,31,59,90,120,151,181,212,243,273,304,334/ !days to add per mo (0th) call date_and_time(values=vv) !sys time day_sec=.001*float(vv(8)+1000*vv(7)+60000*vv(6)+2400000*vv(5)) !real sec of day vect(1)=vv(7) !secs vect(2)=vv(6) !min vect(3)=vv(5) !hr vect(4)=vv(3) !day of month vect(5)=vv(2) !month vect(6)=vv(1) !yyyy !only 2 below need more than re-ordering y1900=(vv(1)-1900) ; sin1900=y1900*365 !years sin 1900 , days without leap l400=mod(vect(6),400).eq.0 !is present yr quadcentury? leapnow=(mod(y1900,4).eq.0) !Greg's leap year rules for present year if((mod(y1900,100).eq.0).and.(.not.L400)) leapnow=.false. c100=y1900/100 ; c400=(y1900+300)/400 !# centuries and quadcent after 1900 ladd= y1900/4 - c100 + c400 ! normalleap -century + 4century (at endyr) if(leapnow) ladd=ladd-1 !dont add this years leap twice, since is in jd below vect(7)=mad(vv(2))+vv(3) !days to mo start+ day of month (without leap) if(leapnow.and.(vv(2).gt.2)) vect(7)=vect(7)+1 sin1900=sin1900 + ladd + vect(7) vect(8)=1+mod(sin1900+7,7) !day of week (sunday=1) return end