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

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

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


Revision 1.1.6.1 - (show annotations) (download)
Thu Mar 6 00:51:39 2003 UTC (21 years, 3 months ago) by heimbach
Branch: ecco-branch
CVS Tags: ecco_c50_e29, ecco_c50_e28, ecco_c44_e27
Branch point for: icebear
Changes since 1.1: +6 -3 lines
o correcting small glitch in checkpoint_lev?
o exf: synchronizing MAIN and ecco-branch
o cal: synchronizing MAIN and ecco-branch

1 C $Header: /u/gcmpack/MITgcm/pkg/cal/cal_toseconds.F,v 1.2 2002/12/19 13:12:42 cheisey Exp $
2
3 #include "CAL_CPPOPTIONS.h"
4
5 subroutine cal_ToSeconds(
6 I date,
7 O timeint,
8 I mythid
9 & )
10
11 c ==================================================================
12 c SUBROUTINE cal_ToSeconds
13 c ==================================================================
14 c
15 c o Given a time interval as a date array return the number of
16 c seconds in that time interval.
17 c
18 c If one wanted to use calendar dates in this routine, then
19 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
21 c refdate. Of course this can also be done by first calling
22 c sub cal_TimePassed and the calling this routine with the
23 c resulting time interval array.
24 c
25 c started: Christian Eckert eckert@mit.edu 30-Jun-1999
26 c
27 c changed: Christian Eckert eckert@mit.edu 29-Dec-1999
28 c
29 c - restructured the original version in order to have a
30 c better interface to the MITgcmUV.
31 c
32 c Christian Eckert eckert@mit.edu 03-Feb-2000
33 c
34 c - Introduced new routine and function names, cal_<NAME>,
35 c for verion 0.1.3.
36 c
37 c ==================================================================
38 c SUBROUTINE cal_ToSeconds
39 c ==================================================================
40
41 implicit none
42
43 c == global variables ==
44
45 #include "cal.h"
46
47 c == routine arguments ==
48
49 integer date(4)
50 _RL timeint
51 integer mythid
52
53 c == local variables ==
54
55 integer fac
56 integer ndays
57 integer nsecs
58 integer hhmmss
59 integer check_sign_1
60 integer check_sign_2
61 integer ierr
62
63 c == end of interface ==
64 c print *,'cal_toseconds: date',date
65 c print *,'cal_toseconds: timeint',timeint
66
67 check_sign_1 = sign(1,date(1))
68 check_sign_2 = sign(1,date(2))
69 if (((date(4) .eq. -1) .and.
70 & (date(3) .eq. 0) .and.
71 & (check_sign_1*check_sign_2 .ge. 0)) .or.
72 & usingModelCalendar) then
73 if ((date(1) .lt. 0) .or.
74 & (date(2) .lt. 0)) then
75 ndays = -date(1)
76 hhmmss = -date(2)
77 fac = -1
78 else
79 ndays = date(1)
80 hhmmss = date(2)
81 fac = 1
82 endif
83 nsecs = ndays*secondsperday +
84 & (hhmmss/10000)*secondsperhour +
85 & mod(hhmmss/100,100)*secondsperminute +
86 & mod(hhmmss,100)
87 timeint = fac*nsecs
88 else
89
90 ierr = 1001
91 call cal_PrintError( ierr, mythid )
92 stop ' stopped in cal_ToSeconds.'
93
94 endif
95
96 return
97 end

  ViewVC Help
Powered by ViewVC 1.1.22