MCPcopy Create free account
hub / github.com/davisking/dlib / timer_test2

Function timer_test2

dlib/test/timer.cpp:139–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137 typename timer_t
138 >
139 void timer_test2 (
140 )
141 /*!
142 requires
143 - timer_t is an implementation of dlib/timer/timer_abstract.h is instantiated
144 timer_test_helper
145 ensures
146 - runs tests on timer_t for compliance with the specs
147 !*/
148 {
149 for (int j = 0; j < 4; ++j)
150 {
151 print_spinner();
152 timer_test_helper h;
153
154 timer_t t1(h,&timer_test_helper::set_timestamp);
155 t1.set_delay_time(0);
156 dlog << LTRACE << "t1.start()";
157 t1.start();
158
159 dlib::sleep(60);
160 print_spinner();
161 t1.stop_and_wait();
162
163 dlib::uint64 cur_time = h.ts.get_timestamp();
164 dlog << LTRACE << "get current time: " << cur_time;
165
166 // make sure the action function has been called recently
167 DLIB_TEST_MSG((cur_time-h.timestamp)/1000 < 30, (cur_time-h.timestamp)/1000);
168
169 }
170 }
171
172 template <
173 typename timer_t

Callers

nothing calls this directly

Calls 3

print_spinnerFunction · 0.85
get_timestampMethod · 0.80
sleepFunction · 0.50

Tested by

no test coverage detected