| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************** | ||
| 2 | Auteur : Pierre Aubert | ||
| 3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
| 4 | Licence : CeCILL-C | ||
| 5 | ****************************************/ | ||
| 6 | |||
| 7 | #ifndef __PCLOCKBACKEND_H__ | ||
| 8 | #define __PCLOCKBACKEND_H__ | ||
| 9 | |||
| 10 | #include "ellapsedTime.h" | ||
| 11 | #include <time.h> | ||
| 12 | #include <thread> | ||
| 13 | |||
| 14 | ///@brief clock backend for clock | ||
| 15 | struct PClockBackend{ | ||
| 16 | ///Get current time with PClockBackend | ||
| 17 | /** @return current time given by clock | ||
| 18 | */ | ||
| 19 | 2 | inline static time_t now(){ | |
| 20 | 2 | return clock(); | |
| 21 | } | ||
| 22 | |||
| 23 | ///Sleep for the given ellapsed time | ||
| 24 | /** @param ellapsedTime : time to sleep | ||
| 25 | */ | ||
| 26 | 1 | inline static void sleep(EllapsedTime ellapsedTime){ | |
| 27 |
1/1✓ Branch 0 (3→4) taken 1 times.
|
1 | std::this_thread::sleep_for(std::chrono::nanoseconds(ellapsedTime)); |
| 28 | 1 | } | |
| 29 | }; | ||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | #endif | ||
| 34 | |||
| 35 |