19 |
c the date should be after the calendar's refdate and timeint |
c the date should be after the calendar's refdate and timeint |
20 |
c would be the number of seconds that have elapsed since the |
c would be the number of seconds that have elapsed since the |
21 |
c refdate. Of course this can also be done by first calling |
c refdate. Of course this can also be done by first calling |
22 |
c sub cal_TimePassed and the calling this routine with the |
c sub cal_TimePassed and then calling this routine with the |
23 |
c resulting time interval array. |
c resulting time interval array. |
24 |
c |
c |
25 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
34 |
c - Introduced new routine and function names, cal_<NAME>, |
c - Introduced new routine and function names, cal_<NAME>, |
35 |
c for verion 0.1.3. |
c for verion 0.1.3. |
36 |
c |
c |
37 |
|
c 21-Sep-2003: fixed check_sign logic to work with |
38 |
|
c negative intervals (menemenlis@jpl.nasa.gov) |
39 |
|
c |
40 |
c ================================================================== |
c ================================================================== |
41 |
c SUBROUTINE cal_ToSeconds |
c SUBROUTINE cal_ToSeconds |
42 |
c ================================================================== |
c ================================================================== |
59 |
integer ndays |
integer ndays |
60 |
integer nsecs |
integer nsecs |
61 |
integer hhmmss |
integer hhmmss |
|
integer check_sign_1 |
|
|
integer check_sign_2 |
|
62 |
integer ierr |
integer ierr |
63 |
|
integer check_sign |
64 |
|
|
65 |
c == end of interface == |
c == end of interface == |
66 |
|
c print *,'cal_toseconds: date',date |
67 |
|
c print *,'cal_toseconds: timeint',timeint |
68 |
|
|
69 |
|
check_sign = 1 |
70 |
|
if ( ( (date(1).lt.0) .and. date(2).gt.0 ) .or. |
71 |
|
& ( (date(1).gt.0) .and. date(2).lt.0 ) ) |
72 |
|
& check_sign = -1 |
73 |
|
|
74 |
check_sign_1 = sign(1,date(1)) |
if (((date(4) .eq. -1) .and. |
|
check_sign_2 = sign(1,date(2)) |
|
|
if ((date(4) .eq. -1) .and. |
|
75 |
& (date(3) .eq. 0) .and. |
& (date(3) .eq. 0) .and. |
76 |
& (check_sign_1*check_sign_2 .ge. 0)) then |
& (check_sign .ge. 0)) .or. |
77 |
|
& usingModelCalendar) then |
78 |
if ((date(1) .lt. 0) .or. |
if ((date(1) .lt. 0) .or. |
79 |
& (date(2) .lt. 0)) then |
& (date(2) .lt. 0)) then |
80 |
ndays = -date(1) |
ndays = -date(1) |