uvgRTP 3.1.3
An open-source library for RTP/SRTP media delivery
Loading...
Searching...
No Matches
clock.hh
1#pragma once
2
3#ifdef _WIN32
4#include <winsock2.h>
5#include <windows.h>
6#else
7#include <sys/time.h>
8#endif
9
10
11#include <chrono>
12
13namespace uvgrtp {
14 namespace clock {
15
16 /* network time protocol */
17 namespace ntp {
23 uint64_t now();
24
35 uint64_t diff(uint64_t ntp1, uint64_t ntp2);
36
47 uint64_t diff_now(uint64_t then);
48 }
49
51 /* high-resolution clock */
52 namespace hrc {
53 typedef std::chrono::high_resolution_clock::time_point hrc_t;
54
55 hrc_t now();
56
57 /* the result is in milliseconds */
58 uint64_t diff(hrc_t hrc1, hrc_t hrc2);
59
60 /* the result is in milliseconds */
61 uint64_t diff_now(hrc_t then);
62
63 uint64_t diff_now_us(hrc_t& then);
64 }
65
66 uint64_t ms_to_jiffies(uint64_t ms);
67 uint64_t jiffies_to_ms(uint64_t jiffies);
68
69#ifdef _WIN32
70 int gettimeofday(struct timeval *tp, struct timezone *tzp);
71#endif
73 }
74}
75
76namespace uvg_rtp = uvgrtp;