libtime++: Date and time calculation

◆ time_norm()

subroutine time_norm ( integer, dimension(7)  date)

Definition at line 37 of file time_norm.f.

References time_fullyear().

37 c
38 c Regularize any time record (relative or absolute)
39 c (i.e. set all fields to correct value range)
40 c
41 c input/output:
42 c date: date record to be regularized
43 c
44 c last change: V2.10 (05/08/2000)
45 c
46  integer date(7)
47 cE
48  integer carry, i, diy
49  integer limit(7)
50  logical time_isleapyear
51  data limit/-1,-1,24,60,60,1000,1000/
52 c
53 c set linear value ranges (from hours on)
54  do i=7,3,-1
55  carry=int(date(i)/limit(i))
56  if (date(i).lt.0) carry=int((date(i)+1)/limit(i))-1
57  date(i)=date(i)-carry*limit(i)
58  date(i-1)=date(i-1)+carry
59  enddo
60 c work on date if not relative
61  if (date(1).gt.0) then
62 c set full 4 digit year
63  call time_fullyear(date(1))
64  if (date(2).gt.0) then
65  if (time_isleapyear(date(1))) then
66  diy=366
67  else
68  diy=365
69  endif
70  1 if (date(2).le.diy) goto 2
71  date(2)=date(2)-diy
72  date(1)=date(1)+1
73  if (time_isleapyear(date(1))) then
74  diy=366
75  else
76  diy=365
77  endif
78  goto 1
79  2 continue
80  else
81  3 if (date(2).gt.0) goto 4
82  date(1)=date(1)-1
83  if (time_isleapyear(date(1))) then
84  diy=366
85  else
86  diy=365
87  endif
88  date(2)=date(2)+diy
89  goto 3
90  4 continue
91  endif
92  endif
93  return
integer time_isleapyear(timeint year)
void time_fullyear(timeint *year)
Here is the call graph for this function: