Move NTP_int32 conversion functions to util.c

This commit is contained in:
Miroslav Lichvar
2013-06-05 12:49:12 +02:00
parent d46e2a69a1
commit 2ceb3c89ca
6 changed files with 29 additions and 28 deletions

16
util.c
View File

@@ -471,6 +471,22 @@ UTI_GetNTPTsFuzz(int precision)
/* ================================================== */
double
UTI_Int32ToDouble(NTP_int32 x)
{
return (double) ntohl(x) / 65536.0;
}
/* ================================================== */
NTP_int32
UTI_DoubleToInt32(double x)
{
return htonl((NTP_int32)(0.5 + 65536.0 * x));
}
/* ================================================== */
/* Seconds part of RFC1305 timestamp correponding to the origin of the
struct timeval format. */
#define JAN_1970 0x83aa7e80UL