130 reqstart(
"2000/12/8 12:37:14"),
131 reqend(
"2000/12/8 12:43:52"),
136 <<
"Example 3: Serving a data request\n" 140 cout <<
" Imagine that you might have a database file that starts\n" 141 <<
" with a first sample at " 142 << std::string(first) <<
".\n" 143 <<
" A client requests a time series that should start at\n" 144 <<
" " << std::string(reqstart) <<
" and end at " 145 <<
" " << std::string(reqend) <<
".\n" 146 <<
" The sampling interval is " << std::string(interval) << endl;
148 long int offset1=(reqstart-first)/interval;
149 long int offset2=(reqend-first)/interval;
150 exstart=first+interval*(offset1);
151 exend=first+interval*(offset2);
152 reqspan=reqend-reqstart;
153 exspan=exend-exstart;
155 cout <<
" The requested time span is " 156 << std::string(reqspan) << endl;
159 <<
" The client will receive a data segment from offset " 160 << offset1 <<
" to " << offset2 <<
".\n";
162 cout <<
" The segment's first sample is at " << std::string(exstart) <<
"\n" 163 <<
" and it's last one is at " << std::string(exend) << endl;
166 "the first delivered sample",
167 reqstart, exstart, interval);
170 "the last delivered sample",
171 reqend, exend, interval);
174 "the sample before the first delivered one",
175 reqstart, exstart-interval, interval);
178 "the sample after the first delivered one",
179 reqstart, exstart+interval, interval);
class to contain relative times
class to contain absolute times
void example3sub1(std::string s1, std::string s2, libtime::TAbsoluteTime t1, libtime::TAbsoluteTime t2, libtime::TRelativeTime i)