| 377 | |
| 378 | |
| 379 | bool apiTest() { |
| 380 | |
| 381 | // prove currentTime has milliseconds granularity since many other things depend on it |
| 382 | int64_t a = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count(); |
| 383 | sleep_(100); |
| 384 | int64_t b = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count(); |
| 385 | if (b - a < 50 || b - a > 150) { |
| 386 | std::cerr << "\t\t\texpected 100ms gap, found " << (b-a) << "ms gap instead." << '\n'; |
| 387 | return false; |
| 388 | } |
| 389 | |
| 390 | return apiTestWithThreadFactory(shared_ptr<ThreadFactory>(new ThreadFactory())); |
| 391 | |
| 392 | } |
| 393 | |
| 394 | bool apiTestWithThreadFactory(shared_ptr<ThreadFactory> threadFactory) |
| 395 | { |