[ntpsec commit] Remove unused uglydate() function and its test.

Eric S. Raymond esr at ntpsec.org
Thu Oct 22 13:42:07 UTC 2015


Module:    ntpsec
Branch:    master
Commit:    c2a85d29495b8dea9576e14d6aa5e510526f67a9
Changeset: http://git.ntpsec.org/ntpsec/commit/?id=c2a85d29495b8dea9576e14d6aa5e510526f67a9

Author:    Eric S. Raymond <esr at thyrsus.com>
Date:      Thu Oct 22 09:41:25 2015 -0400

Remove unused uglydate() function and its test.

---

 include/ntp_fp.h                                 |  1 -
 libntp/uglydate.c                                | 51 ------------------------
 libntp/wscript                                   |  1 -
 ports/winnt/vs2005/libntp.vcproj                 |  4 --
 ports/winnt/vs2008/libntp/libntp.vcproj          |  4 --
 ports/winnt/vs2013/libntp/libntp.vcxproj         |  1 -
 ports/winnt/vs2013/libntp/libntp.vcxproj.filters |  3 --
 tests/libntp/uglydate.cpp                        | 29 --------------
 8 files changed, 94 deletions(-)

diff --git a/include/ntp_fp.h b/include/ntp_fp.h
index e97fcb2..28012f7 100644
--- a/include/ntp_fp.h
+++ b/include/ntp_fp.h
@@ -349,7 +349,6 @@ extern	char *	prettydate	(l_fp *);
 extern	char *	gmprettydate	(l_fp *);
 extern	char *	gmprettydate	(l_fp *);
 extern	char *	rfc3339date	(l_fp *);
-extern	char *	uglydate	(l_fp *);
 extern  void	mfp_mul		(int32_t *, uint32_t *, int32_t, uint32_t, int32_t, uint32_t);
 
 extern	void	set_sys_fuzz	(double);
diff --git a/libntp/uglydate.c b/libntp/uglydate.c
deleted file mode 100644
index cfbf2f5..0000000
--- a/libntp/uglydate.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * uglydate - convert a time stamp to something barely readable
- *	      The string returned is 37 characters long.
- */
-#include <config.h>
-#include <stdio.h>
-
-#include "ntp_fp.h"
-#include "ntp_unixtime.h"
-#include "lib_strbuf.h"
-#include "ntp_stdlib.h"
-
-
-char *
-uglydate(
-	l_fp *ts
-	)
-{
-	char *bp;
-	char *timep;
-	struct tm tmbuf, *tm;
-	time_t sec;
-	long msec;
-	int year;
-
-	timep = ulfptoa(ts, 6);		/* returns max 17 characters */
-	LIB_GETBUF(bp);
-	sec = ts->l_ui - JAN_1970;
-	msec = ts->l_uf / 4294967;	/* fract / (2**32/1000) */
-	tm = gmtime_r(&sec, &tmbuf);
-	if (ts->l_ui == 0) {
-		/*
-		 * Probably not a real good thing to do.  Oh, well.
-		 */
-		year = 0;
-		tm->tm_yday = 0;
-		tm->tm_hour = 0;
-		tm->tm_min = 0;
-		tm->tm_sec = 0;
-	} else {
-		year = tm->tm_year;
-		while (year >= 100)
-		    year -= 100;
-	}
-	snprintf(bp, LIB_BUFLENGTH,
-		 "%17s %02d:%03d:%02d:%02d:%02d.%03ld", timep, year,
-		 tm->tm_yday, tm->tm_hour, tm->tm_min, tm->tm_sec,
-		 msec);
-
-	return bp;
-}
diff --git a/libntp/wscript b/libntp/wscript
index 4e78d8a..256e635 100644
--- a/libntp/wscript
+++ b/libntp/wscript
@@ -55,7 +55,6 @@ def build(ctx):
 		"syssignal.c",
 		"timetoa.c",
 		"timevalops.c",
-		"uglydate.c",
 		"vint64ops.c",
 		"work_thread.c",
 		"ymd2yd.c",
diff --git a/ports/winnt/vs2005/libntp.vcproj b/ports/winnt/vs2005/libntp.vcproj
index 82224c9..4988ba9 100644
--- a/ports/winnt/vs2005/libntp.vcproj
+++ b/ports/winnt/vs2005/libntp.vcproj
@@ -509,10 +509,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\libntp\uglydate.c"
-				>
-			</File>
-			<File
 				RelativePath="..\libntp\util_clockstuff.c"
 				>
 			</File>
diff --git a/ports/winnt/vs2008/libntp/libntp.vcproj b/ports/winnt/vs2008/libntp/libntp.vcproj
index 29dadbc..3033f93 100644
--- a/ports/winnt/vs2008/libntp/libntp.vcproj
+++ b/ports/winnt/vs2008/libntp/libntp.vcproj
@@ -628,10 +628,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\..\libntp\uglydate.c"
-				>
-			</File>
-			<File
 				RelativePath="..\..\libntp\util_clockstuff.c"
 				>
 			</File>
diff --git a/ports/winnt/vs2013/libntp/libntp.vcxproj b/ports/winnt/vs2013/libntp/libntp.vcxproj
index 148d3eb..1b9792c 100644
--- a/ports/winnt/vs2013/libntp/libntp.vcxproj
+++ b/ports/winnt/vs2013/libntp/libntp.vcxproj
@@ -270,7 +270,6 @@
     <ClCompile Include="..\..\..\..\libntp\systime.c" />
     <ClCompile Include="..\..\..\..\libntp\timetoa.c" />
     <ClCompile Include="..\..\..\..\libntp\timevalops.c" />
-    <ClCompile Include="..\..\..\..\libntp\uglydate.c" />
     <ClCompile Include="..\..\..\..\libntp\vint64ops.c" />
     <ClCompile Include="..\..\..\..\libntp\work_fork.c" />
     <ClCompile Include="..\..\..\..\libntp\work_thread.c" />
diff --git a/ports/winnt/vs2013/libntp/libntp.vcxproj.filters b/ports/winnt/vs2013/libntp/libntp.vcxproj.filters
index 6129afd..575a21f 100644
--- a/ports/winnt/vs2013/libntp/libntp.vcxproj.filters
+++ b/ports/winnt/vs2013/libntp/libntp.vcxproj.filters
@@ -281,9 +281,6 @@
     <ClCompile Include="..\..\..\..\libntp\timevalops.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\..\..\libntp\uglydate.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\libntp\util_clockstuff.c">
       <Filter>Source Files</Filter>
     </ClCompile>
diff --git a/tests/libntp/uglydate.cpp b/tests/libntp/uglydate.cpp
deleted file mode 100644
index be0784c..0000000
--- a/tests/libntp/uglydate.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-extern "C" {
-#include "unity.h"
-#include "unity_fixture.h"
-}
-
-TEST_GROUP(uglydate);
-
-TEST_SETUP(uglydate) {}
-
-TEST_TEAR_DOWN(uglydate) {}
-
-#include "libntptest.h"
-
-extern "C" {
-#include "ntp_fp.h"
-};
-
-class uglydateTest : public libntptest {
-protected:
-	static const u_int32 HALF = 2147483648UL;
-};
-
-TEST(uglydate, ConstantDateTime) {
-	l_fp time = {3485080800UL, HALF}; // 2010-06-09 14:00:00.5
-
-	TEST_ASSERT_EQUAL_STRING("3485080800.500000 10:159:14:00:00.500",
-				 uglydate(&time));
-}
-



More information about the vc mailing list