]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Add new files to Windows build.
authorDave Hart <hart@ntp.org>
Wed, 26 Jan 2011 03:07:53 +0000 (03:07 +0000)
committerDave Hart <hart@ntp.org>
Wed, 26 Jan 2011 03:07:53 +0000 (03:07 +0000)
Fix make distcheck by distributing include/timetoa.h and
  tests/libntp/timestructs.h

bk: 4d3f9009BGfFpawogf2P8lj6PKtMhw

include/Makefile.am
include/timetoa.h
libntp/timetoa.c
ports/winnt/vc6/libntp.dsp
ports/winnt/vs2003/libntp.vcproj
ports/winnt/vs2005/libntp.vcproj
ports/winnt/vs2008/libntp/libntp.vcproj
tests/libntp/Makefile.am

index 67716b378b23d324f351aa5e65f970933bee85f5..c65ec9d69a15708ec1edc9c104e1c5b46ad56878 100644 (file)
@@ -70,6 +70,7 @@ noinst_HEADERS =      \
        timepps-Solaris.h       \
        timepps-SunOS.h \
        timespecops.h   \
+       timetoa.h       \
        timevalops.h    \
        trimble.h       \
        $(NULL)
index edcd05b16c8ddec7456070d37f14da9635d4b906..e766d1300b5539f804e67be82a6fcf96b90e7fd0 100644 (file)
@@ -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"
index c8e01a68d0b1f861f29fbb79dfb8fc97cc68ce6c..bcacf095d6e4950aff41643677c71593342a8f22 100644 (file)
 
 #include "config.h"
 
+#include <stdio.h>
+
 #include "timetoa.h"
 #include "lib_strbuf.h"
-#include <stdio.h>
 
 /*
  * 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"
  */
 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;
 }
index f791695c31e3140acdf4b7e74f6b353906a21d97..f117bb55935a7faf22f3e5784983729942229464 100644 (file)
@@ -438,6 +438,10 @@ SOURCE=..\..\..\libntp\timespecops.c
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\..\libntp\timetoa.c\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\..\libntp\timevalops.c\r
 # End Source File\r
 # Begin Source File\r
index 8a7b31135769eba8ed4007ae0cba502d10a88b0a..8f08b011b23332548583547d19a896930588d2bd 100644 (file)
                                RelativePath="..\..\..\lib\isc\win32\time.c">
                        </File>
                        <File
-                               RelativePath="..\libntp\timespecops.c">
+                               RelativePath="..\..\..\libntp\timespecops.c">
                        </File>
                        <File
-                               RelativePath="..\libntp\timevalops.c">
+                               RelativePath="..\..\..\libntp\timetoa.c">
+                       </File>
+                       <File
+                               RelativePath="..\..\..\libntp\timevalops.c">
                        </File>
                        <File
                                RelativePath="..\..\..\libntp\tsftomsu.c">
index 0f3ab066cbe4bd4090e7c7d34c89c082e152e7c9..47512c2e5ca46a0d09633a22230d0073d3227d65 100644 (file)
                                RelativePath="..\..\..\libntp\timespecops.c"
                                >
                        </File>
+                       <File
+                               RelativePath="..\..\..\libntp\timetoa.c"
+                               >
+                       </File>
                        <File
                                RelativePath="..\..\..\libntp\timevalops.c"
                                >
index 9ae299a2d81e970b9bd673997d13da55d649ee9b..e05b4d847ce20d789029b3be70d844a96a7e9c23 100644 (file)
                                RelativePath="..\..\..\..\libntp\timespecops.c"
                                >
                        </File>
+                       <File
+                               RelativePath="..\..\..\..\libntp\timetoa.c"
+                               >
+                       </File>
                        <File
                                RelativePath="..\..\..\..\libntp\timevalops.c"
                                >
                                >
                        </File>
                        <File
-                               RelativePath="..\..\..\..\lib\isc\win32\include\isc\time.h"
+                               RelativePath="..\..\include\sys\time.h"
                                >
                        </File>
                        <File
-                               RelativePath="..\..\include\sys\time.h"
+                               RelativePath="..\..\..\..\lib\isc\win32\include\isc\time.h"
                                >
                        </File>
                        <File
                                RelativePath="..\..\..\..\include\timespecops.h"
                                >
                        </File>
+                       <File
+                               RelativePath="..\..\..\..\include\timetoa.h"
+                               >
+                       </File>
                        <File
                                RelativePath="..\..\..\..\include\timevalops.h"
                                >
index e9efb2a99b39a1272d6b76d3af34c1fd2b1ddf49..19d4818caf57dbc15ae71ef2c20713e67bda003a 100644 (file)
@@ -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