libtime++: Date and time calculation

◆ time_mul()

subroutine time_mul ( integer, dimension(7)  date1,
integer, dimension(7)  date2,
integer  n 
)

Definition at line 33 of file time_mul.f.

References time_norm(), and time_util_fatal().

33 c
34 c Multiply relative time date1 by n and store result in date2.
35 c
36 c input:
37 c date1: relative time record
38 c n: integer factor
39 c output:
40 c date2: date1*n (regularized relative time value)
41 c
42 c last change: V2.00 (05/08/2000)
43 c
44  integer date1(7), date2(7), n
45 cE
46  integer quotient(7), rest(7), product(7), carry(7), i, limit(7)
47  integer help
48  data limit/-1,-1,24,60,60,1000,1000/
49 c
50  if (date1(1).ne.0) then
51  call time_util_fatal('time_mul','no absolute time allowed')
52  else
53  do i=3,7
54 c split n to avoid conflicts with integer range
55  quotient(i)=int(n/limit(i))
56  rest(i)=n-limit(i)*quotient(i)
57  help=int(rest(i)*date1(i)/limit(i))
58  carry(i)=quotient(i)*date1(i)+help
59  product(i)=rest(i)*date1(i)-help*limit(i)
60  enddo
61  product(2)=n*date1(2)
62  do i=2,6
63  date2(i)=product(i)+carry(i+1)
64  enddo
65  date2(7)=product(7)
66  date2(1)=0
67  call time_norm(date2)
68  endif
69  return
subroutine time_util_fatal(caller, text)
void time_norm(time_Ts *Pdate)
Definition: ctime_norm.c:33
Here is the call graph for this function: