1#ifndef NDNPH_PORT_CLOCK_CHRONO_HPP
2#define NDNPH_PORT_CLOCK_CHRONO_HPP
4#include "../../core/common.hpp"
10namespace port_clock_chrono {
17 using Time = std::chrono::steady_clock::time_point;
20 return std::chrono::steady_clock::now();
24 return Time(t.time_since_epoch() +
25 std::chrono::duration_cast<std::chrono::steady_clock::duration>(
26 std::chrono::milliseconds(ms)));
30 return std::chrono::duration_cast<std::chrono::milliseconds>(a - b).count();
38#ifdef NDNPH_PORT_CHRONO_BUSY_SLEEP
43 std::this_thread::sleep_for(std::chrono::milliseconds(ms));
10namespace port_clock_chrono {
…}
50#ifdef NDNPH_PORT_CLOCK_CHRONO
52using Clock = port_clock_chrono::Clock;
Clock implemented with std::chrono.
Definition chrono.hpp:13
std::chrono::steady_clock::time_point Time
Definition chrono.hpp:17
static Time now()
Definition chrono.hpp:19
static Time add(Time t, int ms)
Definition chrono.hpp:23
static void sleep(int ms)
Definition chrono.hpp:37
static int sub(Time a, Time b)
Definition chrono.hpp:29
static bool isBefore(Time a, Time b)
Definition chrono.hpp:33
port_clock_ino::Clock Clock
Definition ino.hpp:59