From: Dave Hart Date: Wed, 26 Jan 2011 03:07:53 +0000 (+0000) Subject: Add new files to Windows build. X-Git-Tag: NTP_4_2_7P125~1^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bde000a36903c9b1f70297c20048cbb2bd72510f;p=thirdparty%2Fntp.git Add new files to Windows build. Fix make distcheck by distributing include/timetoa.h and tests/libntp/timestructs.h bk: 4d3f9009BGfFpawogf2P8lj6PKtMhw --- diff --git a/include/Makefile.am b/include/Makefile.am index 67716b378..c65ec9d69 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -70,6 +70,7 @@ noinst_HEADERS = \ timepps-Solaris.h \ timepps-SunOS.h \ timespecops.h \ + timetoa.h \ timevalops.h \ trimble.h \ $(NULL) diff --git a/include/timetoa.h b/include/timetoa.h index edcd05b16..e766d1300 100644 --- a/include/timetoa.h +++ b/include/timetoa.h @@ -22,7 +22,6 @@ #ifndef TIMETOA_H #define TIMETOA_H -#include "config.h" #include "ntp_fp.h" #include "ntp_stdlib.h" #include "ntp_unixtime.h" diff --git a/libntp/timetoa.c b/libntp/timetoa.c index c8e01a68d..bcacf095d 100644 --- a/libntp/timetoa.c +++ b/libntp/timetoa.c @@ -20,13 +20,14 @@ #include "config.h" +#include + #include "timetoa.h" #include "lib_strbuf.h" -#include /* * Formatting to string needs at max 40 bytes (even with 64 bit time_t), - * so we check LIB_BUFLENGTH is big enough for our pupose. + * so we check LIB_BUFLENGTH is big enough for our purpose. */ #if LIB_BUFLENGTH < 40 # include "GRONK: LIB_BUFLENGTH is not sufficient" @@ -43,22 +44,23 @@ */ const char * format_time_fraction( - time_t secs, - long frac, - int prec + time_t secs, + long frac, + int prec ) { - static const long limit[10] = { + static const long limit[10] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 }; - char * cp; - u_time ttmp; /* unsigned storage for seconds */ - int notneg; /* flag for non-negative value */ - const char * fmt; + char * cp; + u_time ttmp; /* unsigned storage for seconds */ + int notneg; /* flag for non-negative value */ + const char * fmt; + ldiv_t qr; LIB_GETBUF(cp); ttmp = (u_time)secs; @@ -66,14 +68,15 @@ format_time_fraction( /* check if we need signed or unsigned mode */ notneg = (prec < 0); - prec = abs(prec); - if (prec <= 0 || prec > 9) { + prec = abs(prec); + if (prec <= 0 || prec > COUNTOF(limit)) { if (notneg) fmt = "%" UTIME_FORMAT; else fmt = "%" TIME_FORMAT; snprintf(cp, LIB_BUFLENGTH, fmt, secs); - return (cp); + + return cp; } /* @@ -82,7 +85,6 @@ format_time_fraction( * consistency. */ if (frac < 0 || frac >= limit[prec]) { - ldiv_t qr; qr = ldiv(frac, limit[prec]); if (qr.rem < 0) { qr.quot--; @@ -96,17 +98,18 @@ format_time_fraction( * Get the absolute value of the time stamp. */ notneg = notneg || ((time_t)ttmp >= 0); - if (notneg == 0) { + if (!notneg) { ttmp = ~ttmp; if (frac != 0) frac = limit[prec] - frac; else - ttmp += 1; - } else + ttmp += 1; + } else { fmt++; /* skip sign char in format string */ + } /* finally format the data and return the result */ snprintf(cp, LIB_BUFLENGTH, fmt, ttmp, prec, frac); - return (cp); + return cp; } diff --git a/ports/winnt/vc6/libntp.dsp b/ports/winnt/vc6/libntp.dsp index f791695c3..f117bb559 100644 --- a/ports/winnt/vc6/libntp.dsp +++ b/ports/winnt/vc6/libntp.dsp @@ -438,6 +438,10 @@ SOURCE=..\..\..\libntp\timespecops.c # End Source File # Begin Source File +SOURCE=..\..\..\libntp\timetoa.c +# End Source File +# Begin Source File + SOURCE=..\..\..\libntp\timevalops.c # End Source File # Begin Source File diff --git a/ports/winnt/vs2003/libntp.vcproj b/ports/winnt/vs2003/libntp.vcproj index 8a7b31135..8f08b011b 100644 --- a/ports/winnt/vs2003/libntp.vcproj +++ b/ports/winnt/vs2003/libntp.vcproj @@ -1678,10 +1678,13 @@ RelativePath="..\..\..\lib\isc\win32\time.c"> + RelativePath="..\..\..\libntp\timespecops.c"> + RelativePath="..\..\..\libntp\timetoa.c"> + + diff --git a/ports/winnt/vs2005/libntp.vcproj b/ports/winnt/vs2005/libntp.vcproj index 0f3ab066c..47512c2e5 100644 --- a/ports/winnt/vs2005/libntp.vcproj +++ b/ports/winnt/vs2005/libntp.vcproj @@ -1802,6 +1802,10 @@ RelativePath="..\..\..\libntp\timespecops.c" > + + diff --git a/ports/winnt/vs2008/libntp/libntp.vcproj b/ports/winnt/vs2008/libntp/libntp.vcproj index 9ae299a2d..e05b4d847 100644 --- a/ports/winnt/vs2008/libntp/libntp.vcproj +++ b/ports/winnt/vs2008/libntp/libntp.vcproj @@ -543,6 +543,10 @@ RelativePath="..\..\..\..\libntp\timespecops.c" > + + @@ -853,11 +857,11 @@ > + + diff --git a/tests/libntp/Makefile.am b/tests/libntp/Makefile.am index e9efb2a99..19d4818ca 100644 --- a/tests/libntp/Makefile.am +++ b/tests/libntp/Makefile.am @@ -53,11 +53,14 @@ tests_SOURCES = $(top_srcdir)/sntp/tests_main.cpp \ tvtots.cpp \ uglydate.cpp \ uinttoa.cpp \ - ymd2yd.cpp + ymd2yd.cpp \ + $(NULL) noinst_HEADERS = lfptest.h \ libntptest.h \ - sockaddrtest.h + sockaddrtest.h \ + timestructs.h \ + $(NULL) INCLUDES = -I$(top_srcdir)/include INCLUDES += -I$(top_srcdir)/lib/isc/include