26 #ifndef CCUTIL_OCRCLASS_H_
27 #define CCUTIL_OCRCLASS_H_
123 auto chrono_end_time = std::chrono::time_point<std::chrono::steady_clock,
124 std::chrono::milliseconds>();
125 timePointToTimeval(chrono_end_time, &
end_time);
130 if (deadline_msecs > 0) {
131 auto chrono_end_time = std::chrono::steady_clock::now() +
132 std::chrono::milliseconds(deadline_msecs);
133 timePointToTimeval(chrono_end_time, &
end_time);
141 auto chrono_now = std::chrono::steady_clock::now();
143 timePointToTimeval(chrono_now, &now);
144 return (now.tv_sec >
end_time.tv_sec ||
149 static void timePointToTimeval(
150 std::chrono::steady_clock::time_point chrono_point,
struct timeval* tv) {
151 auto millisecs = std::chrono::duration_cast<std::chrono::milliseconds>(
152 chrono_point.time_since_epoch());
153 tv->tv_sec = millisecs.count() / 1000;
154 tv->tv_usec = (millisecs.count() % 1000) * 1000;
157 static bool default_progress_func(
ETEXT_DESC* ths,
int left,
int right,
158 int top,
int bottom) {
167 #endif // CCUTIL_OCRCLASS_H_