libtime++: Date and time calculation

◆ time_read()

subroutine time_read ( character*(*)  string,
integer, dimension(7)  date 
)

Definition at line 32 of file time_read.f.

References time_clear(), time_fullyear(), time_norm(), and time_setdoy().

32 c
33 c Reads date value from string.
34 c
35 c The timestring has to provide time information in the order
36 c
37 c year month day hours minutes seconds
38 c
39 c where seconds may be given as a floating point number. All items must be
40 c separated by non-numerical characters.
41 c
42 c input:
43 c string: character string specifying date value
44 c output:
45 c date: fully qualified and regularized time record
46 c
47 c last change: V2.00 (05/08/2000)
48 c
49  character*(*) string
50  integer date(7)
51 c
52 cE
53  integer numbers(5), i, first, last, length, index
54  double precision seconds
55 c
56  call time_clear(date)
57 c fill array with numbers
58  length=len(string)
59  first=1
60  do i=1,5
61  numbers(i)=0
62  do while ((first.lt.length).and.
63  & (index('.0123456789', string(first:first)).eq.0))
64  first=first+1
65  enddo
66  last=first
67  do while ((last.lt.length).and.
68  & (index('.0123456789', string(last:last)).gt.0))
69  last=last+1
70  enddo
71  if (index('0123456789', string(last:last)).lt.1) last=last-1
72  if ((first.le.length).and.(index('0123456789',
73  & string(first:first)).gt.0)) then
74  read(string(first:last), *) numbers(i)
75  first=last+1
76  endif
77  enddo
78 c read seconds
79  seconds=0.d0
80  do while ((first.lt.length).and.
81  & (index('.0123456789', string(first:first)).eq.0))
82  first=first+1
83  enddo
84  last=first
85  do while ((last.lt.length).and.
86  & (index('.0123456789', string(last:last)).gt.0))
87  last=last+1
88  enddo
89  read(string(first:last), *)
90  if ((first.le.length).and.(index('0123456789',
91  & string(first:first)).gt.0)) then
92  read(string(first:last), *) seconds
93  first=last+1
94  endif
95 c
96  if ((numbers(1).gt.0).or.(numbers(2).gt.0)) then
97 c absolute date
98  date(1)=numbers(1)
99  call time_fullyear(date(1))
100  call time_setdoy(numbers(3),numbers(2),date)
101  else
102 c relative date
103  date(2)=numbers(3)
104  endif
105 c hour and minute
106  do i=1,2
107  date(i+2)=numbers(i+3)
108  enddo
109 c seconds, etc.
110  date(5)=int(seconds)
111  seconds=(seconds-dble(date(5)))*1000.d0
112  date(6)=int(seconds)
113  seconds=(seconds-dble(date(6)))*1000.d0
114  date(7)=int(seconds+0.5d0)
115 c
116  call time_norm(date)
117 c
118  return
void time_setdoy(timeint day, timeint month, time_Ts *Pdate)
Definition: ctime_setdoy.c:36
void time_clear(time_Ts *Pdate)
Definition: ctime_clear.c:33
void time_norm(time_Ts *Pdate)
Definition: ctime_norm.c:33
void time_fullyear(timeint *year)
Here is the call graph for this function: