UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
src
ntp.c
Go to the documentation of this file.
1
/*
2
* FILE: ntp.h
3
* AUTHOR: O.Hodson
4
*
5
* NTP utility functions to make rtp and rtp round time calculation
6
* a little less painful.
7
*
8
* Copyright (c) 2000 University College London
9
* All rights reserved.
10
*
11
* $Revision: 1.1 $
12
* $Date: 2007/11/08 09:48:59 $
13
*
14
*/
15
16
#include "config.h"
17
#include "
config_unix.h
"
18
#include "
config_win32.h
"
19
20
#include <sys/time.h>
21
22
#include "
ntp.h
"
23
24
#define SECS_BETWEEN_1900_1970 2208988800u
25
26
void
ntp64_time
(uint32_t * ntp_sec, uint32_t * ntp_frac)
27
{
28
struct
timeval now;
29
uint32_t tmp;
/* now.tv_usec is signed on many platforms; compensate */
30
31
gettimeofday(&now, NULL);
32
33
/* NB ntp_frac is in units of 1 / (2^32 - 1) secs. */
34
*ntp_sec = now.tv_sec +
SECS_BETWEEN_1900_1970
;
35
tmp = now.tv_usec;
36
*ntp_frac = (tmp << 12) + (tmp << 8) - ((tmp * 3650) >> 6);
37
}
config_unix.h
config_win32.h
SECS_BETWEEN_1900_1970
#define SECS_BETWEEN_1900_1970
Definition
ntp.c:24
ntp64_time
void ntp64_time(uint32_t *ntp_sec, uint32_t *ntp_frac)
Definition
ntp.c:26
ntp.h
Generated on Wed Sep 25 2024 14:27:17 for UltraGrid by
1.12.0