PhoenixClock  2.2.0
Library wrapping the usage of system's clock, allowing to use clock mock-ups
Loading...
Searching...
No Matches
PClockBackend.h
Go to the documentation of this file.
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
17
19 inline static time_t now(){
20 return clock();
21 }
22
24
26 inline static void sleep(EllapsedTime ellapsedTime){
27 std::this_thread::sleep_for(std::chrono::nanoseconds(ellapsedTime));
28 }
29};
30
31
32
33#endif
34
time_t EllapsedTime
clock backend for clock
static time_t now()
Get current time with PClockBackend.
static void sleep(EllapsedTime ellapsedTime)
Sleep for the given ellapsed time.