1 real function da_diff_seconds (date_char_1, date_char_2)
3 !-----------------------------------------------------------------------
5 !-----------------------------------------------------------------------
9 character(len=24), intent(in) :: date_char_1, date_char_2
11 integer :: ccyy_1,mo_1,dd_1,hh_1,mi_1,ss_1,jd_1
12 integer :: ccyy_2,mo_2,dd_2,hh_2,mi_2,ss_2,jd_2
13 integer :: i, year, diff_days
14 integer :: start_year, end_year
19 if (trace_use_dull) call da_trace_entry("da_diff_seconds")
21 mmday=(/31,28,31,30,31,30,31,31,30,31,30,31/)
23 read(date_char_1(1:19), fmt='(i4,1x,4(i2,1x),i2)') &
31 read(date_char_2(1:19), fmt='(i4,1x,4(i2,1x),i2)') &
39 if (ccyy_2 >= ccyy_1) then
49 do year=start_year,end_year-1
50 diff_days = diff_days + 365
51 if (mod(year,4) == 0) then
52 diff_days = diff_days + 1
54 if ((mod(year,100) == 0) .and. (mod(year,400) /= 0)) then
55 diff_days = diff_days - 1
60 if (mod(ccyy_1,4) == 0) then
63 if((mod(ccyy_1,100) == 0) .and. (mod(ccyy_1,400) /= 0)) then
79 if (mod(ccyy_2,4) == 0) then
82 if((mod(ccyy_2,100) == 0) .and. (mod(ccyy_2,400) /= 0)) then
87 if (ccyy_2 >= ccyy_1) then
88 jd_2 = dd_2 + diff_days
90 jd_2 = dd_2 - diff_days
102 da_diff_seconds = abs(s_1 - s_2)
104 if (trace_use_dull) call da_trace_exit("da_diff_seconds")
106 end function da_diff_seconds