Drop duplicated int64_to_timeval()

This commit is contained in:
Miroslav Lichvar 2013-06-05 13:11:53 +02:00
parent 8eb7ce8581
commit 0074135097

15
util.c
View file

@ -210,19 +210,6 @@ UTI_TimevalToString(struct timeval *tv)
return result; return result;
} }
/* ================================================== */
#define JAN_1970 0x83aa7e80UL
inline static void
int64_to_timeval(NTP_int64 *src,
struct timeval *dest)
{
dest->tv_sec = ntohl(src->hi) - JAN_1970;
/* Until I invent a slick way to do this, just do it the obvious way */
dest->tv_usec = (int)(0.5 + (double)(ntohl(src->lo)) / 4294.967296);
}
/* ================================================== */ /* ================================================== */
/* Convert an NTP timestamp into a temporary string, largely /* Convert an NTP timestamp into a temporary string, largely
for diagnostic display */ for diagnostic display */
@ -231,7 +218,7 @@ char *
UTI_TimestampToString(NTP_int64 *ts) UTI_TimestampToString(NTP_int64 *ts)
{ {
struct timeval tv; struct timeval tv;
int64_to_timeval(ts, &tv); UTI_Int64ToTimeval(ts, &tv);
return UTI_TimevalToString(&tv); return UTI_TimevalToString(&tv);
} }