libtime++: Date and time calculation
time_sprint.f
Go to the documentation of this file.
1 c this is <time_sprint.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 print date value to string
24 c NOTICE: this routine is very language specific ;-)
25 c
26 c REVISIONS and CHANGES
27 c 05/08/2000 V2.0 Thomas Forbriger
28 c
29 c ============================================================================
30 cS
31  subroutine time_sprint(date, string)
32 c
33 c Print date to string (string must be 35 characters long at least)
34 c
35 c input:
36 c date: date record to be printed
37 c output:
38 c string: text representation of date value
39 c
40 c last change: V2.00 (05/08/2000)
41 c
42  integer date(7)
43  character*(*) string
44 cE
45  character*(35) ostring
46  integer i, day, month, d(7)
47 c
48  call time_copy(date, d)
49  call time_norm(d)
50 c check for relative date
51  if (d(1).gt.0) then
52  call time_getdate(day, month, d)
53  write(ostring, 1) d(2), day, month, d(1), (d(i), i=3,7)
54  1 format(i3.3,1x,2(i2.2,1h/),i4.4,1x,i2.2,2(1h:,i2.2),1h.,2(i3.3))
55  else
56  if (d(2).eq.1) then
57  write(ostring, 2) (d(i), i=2,7)
58  else
59  write(ostring, 3) (d(i), i=2,7)
60  endif
61  2 format(i5,' day ',i2.2,2(1h:,i2.2),1h.,2(i3.3))
62  3 format(i5,' days ',i2.2,2(1h:,i2.2),1h.,2(i3.3))
63  endif
64  string=ostring
65  return
66  end
67 c
68 c ----- END OF <time_sprint.f> -----
char * time_sprint(time_Ts Date)
Definition: ctime_sprint.c:39
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