libtime++: Date and time calculation
time_getdate.f
Go to the documentation of this file.
1 c this is <time_getdate.f> (extracted from ../libtime.f)
2 c automatically generated by "SPLITF.PL V1.0 SPLIT Fortran source code"
3 c----------------------------------------------------------------------
4 c
5 c Copyright 2000 by Thomas Forbriger (IfG Stuttgart)
6 c
7 c ----
8 c libtime is free software; you can redistribute it and/or modify
9 c it under the terms of the GNU General Public License as published by
10 c the Free Software Foundation; either version 2 of the License, or
11 c (at your option) any later version.
12 c
13 c This program is distributed in the hope that it will be useful,
14 c but WITHOUT ANY WARRANTY; without even the implied warranty of
15 c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 c GNU General Public License for more details.
17 c
18 c You should have received a copy of the GNU General Public License
19 c along with this program; if not, write to the Free Software
20 c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 c ----
22 c
23 c return month and day index from doy index
24 c
25 c REVISIONS and CHANGES
26 c 05/08/2000 V2.0 Thomas Forbriger
27 c
28 c ============================================================================
29 cS
30  subroutine time_getdate(day, month, date)
31 c
32 c get day and month index for given doy (day of year) in date
33 c
34 c input:
35 c date: absolute date record
36 c output:
37 c day: day index within month
38 c month: month index within year
39 c
40 c last change: V2.00 (05/08/2000)
41 c
42  integer date(7), day, month
43 cE
44  integer days(12,2), d(7)
45  integer sel
46  logical time_isleapyear
47  data days/31,28,31,30,31,30,31,31,30,31,30,31,
48  & 31,29,31,30,31,30,31,31,30,31,30,31/
49 c
50  call time_copy(date, d)
51  call time_norm(d)
52  day=d(2)
53 c check for realtive date
54  if (d(1).gt.0) then
55  if (time_isleapyear(d(1))) then
56  sel=2
57  else
58  sel=1
59  endif
60  month=1
61  1 if (day.le.days(month,sel)) goto 2
62  day=day-days(month,sel)
63  month=month+1
64  goto 1
65  2 continue
66  else
67  month=0
68  endif
69  return
70  end
71 c
72 c ----- END OF <time_getdate.f> -----
void time_getdate(timeint *day, timeint *month, time_Ts Date)
Definition: ctime_getdate.c:36
void time_copy(time_Ts Date1, time_Ts *Pdate2)
Definition: ctime_copy.c:33
void time_norm(time_Ts *Pdate)
Definition: ctime_norm.c:33