libtime++: Date and time calculation
time_div.f
Go to the documentation of this file.
1 c this is <time_div.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 divide relative time record by an integer
24 c
25 c REVISIONS and CHANGES
26 c 05/08/2000 V1.0 Thomas Forbriger
27 c V2.0 call language specific fatal error wrapper
28 c
29 c ============================================================================
30 cS
31  subroutine time_div(date1, date2, n, rest)
32 c
33 c Divide relative time 'date1' by integer 'n' and store result in 'date2'.
34 c 'rest' gives the none dividable rest in microseconds.
35 c
36 c input:
37 c date1: relative time value to be divided
38 c n: divisor
39 c output:
40 c date2: date1/n regularized relative time value
41 c rest: date1-(n*date2) integer number of microseconds
42 c
43 c always: date1 >= (n*date2)
44 c
45 c last change: V2.00 (05/08/2000)
46 c
47  integer date1(7), date2(7), n, rest
48 cE
49  integer carry, limit(7), help, i
50  data limit/-1,-1,24,60,60,1000,1000/
51 c
52  if (date1(1).ne.0) then
53  call time_util_fatal('(time_div)','no absolute time allowed')
54  else
55  carry=0
56  do i=2,7
57  help=date1(i)+carry*limit(i)
58  date2(i)=int(help/n)
59  carry=help-n*date2(i)
60  enddo
61  rest=carry
62  date2(1)=0
63  call time_norm(date2)
64  endif
65  return
66  end
67 c
68 c ----- END OF <time_div.f> -----
void time_div(time_Ts Date1, time_Ts *Pdate2, timeint n, timeint *rest)
Definition: ctime_div.c:36
subroutine time_util_fatal(caller, text)
void time_norm(time_Ts *Pdate)
Definition: ctime_norm.c:33