/[MITgcm]/MITgcm/pkg/cal/cal_toseconds.F
ViewVC logotype

Diff of /MITgcm/pkg/cal/cal_toseconds.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2 by cheisey, Thu Dec 19 13:12:42 2002 UTC revision 1.5 by edhill, Thu Oct 9 04:19:19 2003 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2    C $Name$
3    
4  #include "CAL_CPPOPTIONS.h"  #include "CAL_OPTIONS.h"
5    
6        subroutine cal_ToSeconds(        subroutine cal_ToSeconds(
7       I                          date,       I                          date,
# Line 19  c       If one wanted to use calendar da Line 20  c       If one wanted to use calendar da
20  c       the date should be after the calendar's refdate and timeint  c       the date should be after the calendar's refdate and timeint
21  c       would be the number of seconds that have elapsed since the  c       would be the number of seconds that have elapsed since the
22  c       refdate. Of course this can also be done by first calling  c       refdate. Of course this can also be done by first calling
23  c       sub cal_TimePassed and the calling this routine with the  c       sub cal_TimePassed and then calling this routine with the
24  c       resulting time interval array.  c       resulting time interval array.
25  c                c              
26  c     started: Christian Eckert eckert@mit.edu  30-Jun-1999  c     started: Christian Eckert eckert@mit.edu  30-Jun-1999
# Line 34  c Line 35  c
35  c              - Introduced new routine and function names, cal_<NAME>,  c              - Introduced new routine and function names, cal_<NAME>,
36  c                for verion 0.1.3.  c                for verion 0.1.3.
37  c  c
38    c              21-Sep-2003: fixed check_sign logic to work with
39    c              negative intervals (menemenlis@jpl.nasa.gov)
40    c
41  c     ==================================================================  c     ==================================================================
42  c     SUBROUTINE cal_ToSeconds  c     SUBROUTINE cal_ToSeconds
43  c     ==================================================================  c     ==================================================================
# Line 56  c     == local variables == Line 60  c     == local variables ==
60        integer ndays        integer ndays
61        integer nsecs        integer nsecs
62        integer hhmmss        integer hhmmss
       integer check_sign_1  
       integer check_sign_2  
63        integer ierr        integer ierr
64          integer check_sign
65    
66  c     == end of interface ==  c     == end of interface ==
67  c     print *,'cal_toseconds: date',date  c     print *,'cal_toseconds: date',date
68  c     print *,'cal_toseconds: timeint',timeint  c     print *,'cal_toseconds: timeint',timeint
69    
70        check_sign_1 = sign(1,date(1))        check_sign = 1
71        check_sign_2 = sign(1,date(2))        if ( ( (date(1).lt.0) .and. date(2).gt.0 ) .or.
72         &     ( (date(1).gt.0) .and. date(2).lt.0 ) )
73         &     check_sign = -1
74    
75        if (((date(4) .eq. -1) .and.        if (((date(4) .eq. -1) .and.
76       &    (date(3) .eq.  0) .and.       &    (date(3) .eq.  0) .and.
77       &    (check_sign_1*check_sign_2 .ge. 0)) .or.       &    (check_sign .ge. 0)) .or.
78       &    usingModelCalendar) then       &    usingModelCalendar) then
79          if ((date(1) .lt. 0) .or.          if ((date(1) .lt. 0) .or.
80       &      (date(2) .lt. 0)) then       &      (date(2) .lt. 0)) then

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.22