/[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.1 by heimbach, Mon May 14 22:07:27 2001 UTC revision 1.4 by dimitri, Tue Sep 23 06:33:45 2003 UTC
# Line 19  c       If one wanted to use calendar da Line 19  c       If one wanted to use calendar da
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
# Line 34  c Line 34  c
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     ==================================================================
# Line 56  c     == local variables == Line 59  c     == local variables ==
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)

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.22