[Git][NTPsec/ntpsec][master] 3 commits: Remove no-longer-used funcrions calgregorian() and caltontp()

Eric S. Raymond gitlab at mg.gitlab.com
Tue Aug 23 23:25:18 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
8c84e1ff by Eric S. Raymond at 2016-08-23T18:24:32-04:00
Remove no-longer-used funcrions calgregorian() and caltontp()

- - - - -
1b9a4c40 by Eric S. Raymond at 2016-08-23T18:40:16-04:00
Remove gross hacks that were actually *labeled* "gross hacks".

- - - - -
4ac4e5d7 by Eric S. Raymond at 2016-08-23T19:25:01-04:00
Cruft removal.

- - - - -


17 changed files:

- include/ntp_calendar.h
- − libntp/calgregorian.c
- − libntp/caltontp.c
- libntp/ntp_calendar.c
- libntp/wscript
- libparse/clk_meinberg.c
- libparse/clk_rawdcf.c
- libparse/parse.c
- ports/winnt/vs2005/libntp.vcproj
- ports/winnt/vs2008/libntp/libntp.vcproj
- ports/winnt/vs2013/libntp/libntp.vcxproj
- ports/winnt/vs2013/libntp/libntp.vcxproj.filters
- tests/check_y2k.c
- tests/common/tests_main.c
- − tests/libntp/calgregorian.c
- − tests/libntp/caltontp.c
- tests/wscript


Changes:

=====================================
include/ntp_calendar.h
=====================================
--- a/include/ntp_calendar.h
+++ b/include/ntp_calendar.h
@@ -94,21 +94,6 @@ extern systime_func_ptr ntpcal_set_timefunc(systime_func_ptr);
 #define	SECSPERAVGYEAR	31556952		/* mean year length over 400yrs */
 
 /*
- * Gross hacks.	 I have illicit knowlege that there won't be overflows
- * here, the compiler often can't tell this.
- */
-#define	TIMES60(val)	((((val)<<4) - (val))<<2)	/* *(16 - 1) * 4 */
-#define	TIMES24(val)	(((val)<<4) + ((val)<<3))	/* *16 + *8 */
-#define	TIMES7(val)	(((val)<<3) - (val))		/* *8  - *1 */
-#define	TIMESDPERC(val)	(((val)<<10) + ((val)<<8) \
-			+ ((val)<<7) + ((val)<<5) \
-			+ ((val)<<4) + ((val)<<2) + (val))	/* *big* hack */
-
-
-extern	void	 calgregorian	(uint32_t, struct calendar *);
-extern	uint32_t caltontp	(const struct calendar *);
-
-/*
  * Convert between 'time_t' and 'vint64'
  */
 extern vint64 time_to_vint64(const time_t *);


=====================================
libntp/calgregorian.c deleted
=====================================
--- a/libntp/calgregorian.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * calgregorian - determine the Gregorian date from an NTP time.
- */
-#include <config.h>
-#include <sys/types.h>
-
-#include "ntp_types.h"
-#include "ntp_calendar.h"
-
-#if !(defined(ISC_CHECK_ALL) || defined(ISC_CHECK_NONE) || \
-      defined(ISC_CHECK_ENSURE) || defined(ISC_CHECK_INSIST) || \
-      defined(ISC_CHECK_INVARIANT))
-# define ISC_CHECK_ALL
-#endif
-
-#include "ntp_assert.h"
-
-void
-calgregorian(
-	uint32_t		ntp,
-	struct calendar *	jt
-	)
-{
-	vint64		vlong;
-	ntpcal_split	split;
-	
-	
-	NTP_INSIST(NULL != jt);
-
-	/*
-	 * Unfold ntp time around current time into NTP domain. Split
-	 * into days and seconds, shift days into CE domain and
-	 * process the parts.
-	 */
-	vlong = ntpcal_ntp_to_ntp(ntp, NULL);
-	split = ntpcal_daysplit(&vlong);
-	ntpcal_daysplit_to_date(jt, &split, DAY_NTP_STARTS);
-}


=====================================
libntp/caltontp.c deleted
=====================================
--- a/libntp/caltontp.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * caltontp - convert a date to an NTP time
- */
-#include <config.h>
-#include <sys/types.h>
-
-#include "ntp_types.h"
-#include "ntp_calendar.h"
-#include "ntp_stdlib.h"
-#include "ntp_assert.h"
-#include "ntp_unixtime.h"
-
-/*
- * Juergen Perlinger, 2008-11-12
- * Add support for full calendar calculatios. If the day-of-year is provided
- * (that is, not zero) it will be used instead of month and day-of-month;
- * otherwise a full turn through the calendar calculations will be taken.
- *
- * I know that Harlan Stenn likes to see assertions in production code, and I
- * agree there, but it would be a tricky thing here. The algorithm is quite
- * capable of producing sensible answers even to seemingly weird inputs: the
- * date <any year here>-03-00, the 0.th March of the year, will be automtically
- * treated as the last day of February, no matter whether the year is a leap
- * year or not. So adding constraints is merely for the benefit of the callers,
- * because the only thing we can check for consistency is our input, produced
- * by somebody else.
- *
- * BTW: A total roundtrip using 'calgregorian' would be a quite shaky thing:
- * Because of the truncation of the NTP time stamp to 32 bits and the epoch
- * unfolding around the current time done by 'calgregorian' the roundtrip does
- * *not* necessarily reproduce the input, especially if the time spec is more
- * than 68 years off from the current time...
- */
-
-uint32_t
-caltontp(
-	const struct calendar *jt
-	)
-{
-	int32_t eraday;	/* CE Rata Die number	*/
-	vint64  ntptime;/* resulting NTP time	*/
-
-	NTP_INSIST(jt != NULL);
-
-	NTP_REQUIRE(jt->month <= 13);	/* permit month 0..13! */
-	NTP_REQUIRE(jt->monthday <= 32);
-	NTP_REQUIRE(jt->yearday <= 366);
-	NTP_REQUIRE(jt->hour <= 24);
-	NTP_REQUIRE(jt->minute <= MINSPERHR);
-	NTP_REQUIRE(jt->second <= SECSPERMIN);
-
-	/*
-	 * First convert the date to he corresponding RataDie
-	 * number. If yearday is not zero, assume that it contains a
-	 * useable value and avoid all calculations involving month
-	 * and day-of-month. Do a full evaluation otherwise.
-	 */
-	if (jt->yearday)
-		eraday = ntpcal_year_to_ystart(jt->year)
-		       + jt->yearday - 1;
-	else
-		eraday = ntpcal_date_to_rd(jt);
-
-	ntptime = ntpcal_dayjoin(eraday - DAY_NTP_STARTS,
-				 ntpcal_etime_to_seconds(jt->hour, jt->minute,
-							 jt->second));
-	return ntptime.d_s.lo;
-}


=====================================
libntp/ntp_calendar.c
=====================================
--- a/libntp/ntp_calendar.c
+++ b/libntp/ntp_calendar.c
@@ -1113,13 +1113,6 @@ ntpcal_date_to_time(
 }
 
 
-/*
- * ==================================================================
- *
- * extended and unchecked variants of calgregorian/caltontp
- *
- * ==================================================================
- */
 int
 ntpcal_ntp64_to_date(
 	struct calendar *jd,
@@ -1405,7 +1398,7 @@ isocal_ntp64_to_date(
 	ds.lo = ds.lo % 7;			/* elapsed week days */
 	if (ds.lo < 0) {			/* floor division!   */
 		ds.hi -= 1;
-		ds.lo += 7;
+//		ds.lo += 7;
 	}
 	id->weekday = (uint8_t)ds.lo + 1;	/* weekday result    */
 


=====================================
libntp/wscript
=====================================
--- a/libntp/wscript
+++ b/libntp/wscript
@@ -7,8 +7,6 @@ def build(ctx):
 		"authkeys.c",
 		"authreadkeys.c",
 		"authusekey.c",
-		"calgregorian.c",
-		"caltontp.c",
 		"calyearstart.c",
 		"clocktime.c",
 		"decodenetnum.c",


=====================================
libparse/clk_meinberg.c
=====================================
--- a/libparse/clk_meinberg.c
+++ b/libparse/clk_meinberg.c
@@ -484,8 +484,8 @@ cvt_mgps(
 					return CVT_FAIL|CVT_BADFMT;
 				}
 
-				clock_time->utcoffset += TIMES60(h);
-				clock_time->utcoffset  = TIMES60(clock_time->utcoffset);
+				clock_time->utcoffset += h * 60;
+				clock_time->utcoffset  = clock_time->utcoffset * 60;
 
 				if (buffer[format->field_offsets[O_UTCSOFFSET].offset] != '-')
 				{


=====================================
libparse/clk_rawdcf.c
=====================================
--- a/libparse/clk_rawdcf.c
+++ b/libparse/clk_rawdcf.c
@@ -225,7 +225,6 @@ convert_rawdcf(
 	    pcheck(buffer, DCF_P_P2, dcfprm->zerobits) &&
 	    pcheck(buffer, DCF_P_P3, dcfprm->zerobits))
 	{
-#define TIMES10(_X_)	(((_X_) << 3) + ((_X_) << 1))
 
 		/*
 		 * buffer OK
@@ -237,16 +236,15 @@ convert_rawdcf(
 		clock_time->usecond= 0;
 		clock_time->second = 0;
 		clock_time->minute = ext_bf(buffer, DCF_M10, dcfprm->zerobits);
-		clock_time->minute = TIMES10(clock_time->minute) + ext_bf(buffer, DCF_M1, dcfprm->zerobits);
+		clock_time->minute = 10*(clock_time->minute) + ext_bf(buffer, DCF_M1, dcfprm->zerobits);
 		clock_time->hour   = ext_bf(buffer, DCF_H10, dcfprm->zerobits);
-		clock_time->hour   = TIMES10(clock_time->hour) + ext_bf(buffer, DCF_H1, dcfprm->zerobits);
+		clock_time->hour   = 10*(clock_time->hour) + ext_bf(buffer, DCF_H1, dcfprm->zerobits);
 		clock_time->day    = ext_bf(buffer, DCF_D10, dcfprm->zerobits);
-		clock_time->day    = TIMES10(clock_time->day) + ext_bf(buffer, DCF_D1, dcfprm->zerobits);
+		clock_time->day    = 10*(clock_time->day) + ext_bf(buffer, DCF_D1, dcfprm->zerobits);
 		clock_time->month  = ext_bf(buffer, DCF_MO0, dcfprm->zerobits);
-		clock_time->month  = TIMES10(clock_time->month) + ext_bf(buffer, DCF_MO, dcfprm->zerobits);
+		clock_time->month  = 10*(clock_time->month) + ext_bf(buffer, DCF_MO, dcfprm->zerobits);
 		clock_time->year   = ext_bf(buffer, DCF_Y10, dcfprm->zerobits);
-		clock_time->year   = TIMES10(clock_time->year) + ext_bf(buffer, DCF_Y1, dcfprm->zerobits);
-#undef TIMES10
+		clock_time->year   = 10*(clock_time->year) + ext_bf(buffer, DCF_Y1, dcfprm->zerobits);
 
 		switch (ext_bf(buffer, DCF_Z, dcfprm->zerobits))
 		{


=====================================
libparse/parse.c
=====================================
--- a/libparse/parse.c
+++ b/libparse/parse.c
@@ -411,7 +411,7 @@ parse_to_unixtime(
 		return -1;		/* bad hour */
 	}
 
-	t = TIMES24(t) + clock_time->hour;
+	t = t*24 + clock_time->hour;
 
 				/* min */
 	if (clock_time->minute < 0 || clock_time->minute > 59)
@@ -420,7 +420,7 @@ parse_to_unixtime(
 		return -1;		/* bad min */
 	}
 
-	t = TIMES60(t) + clock_time->minute;
+	t = t*60 + clock_time->minute;
 				/* sec */
 
 	if (clock_time->second < 0 || clock_time->second > 60)	/* allow for LEAPs */
@@ -429,7 +429,7 @@ parse_to_unixtime(
 		return -1;		/* bad sec */
 	}
 
-	t  = TIMES60(t) + clock_time->second;
+	t  = t*60 + clock_time->second;
 
 	t += clock_time->utcoffset;	/* warp to UTC */
 


=====================================
ports/winnt/vs2005/libntp.vcproj
=====================================
--- a/ports/winnt/vs2005/libntp.vcproj
+++ b/ports/winnt/vs2005/libntp.vcproj
@@ -217,14 +217,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\libntp\calgregorian.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\libntp\caltontp.c"
-				>
-			</File>
-			<File
 				RelativePath="..\..\..\libntp\calyearstart.c"
 				>
 			</File>


=====================================
ports/winnt/vs2008/libntp/libntp.vcproj
=====================================
--- a/ports/winnt/vs2008/libntp/libntp.vcproj
+++ b/ports/winnt/vs2008/libntp/libntp.vcproj
@@ -316,14 +316,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\..\libntp\calgregorian.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\..\libntp\caltontp.c"
-				>
-			</File>
-			<File
 				RelativePath="..\..\..\..\libntp\calyearstart.c"
 				>
 			</File>


=====================================
ports/winnt/vs2013/libntp/libntp.vcxproj
=====================================
--- a/ports/winnt/vs2013/libntp/libntp.vcxproj
+++ b/ports/winnt/vs2013/libntp/libntp.vcxproj
@@ -218,8 +218,6 @@
     <ClCompile Include="..\..\..\..\libntp\authreadkeys.c" />
     <ClCompile Include="..\..\..\..\libntp\authusekey.c" />
     <ClCompile Include="..\..\..\..\libntp\a_md5encrypt.c" />
-    <ClCompile Include="..\..\..\..\libntp\calgregorian.c" />
-    <ClCompile Include="..\..\..\..\libntp\caltontp.c" />
     <ClCompile Include="..\..\..\..\libntp\calyearstart.c" />
     <ClCompile Include="..\..\..\..\libntp\clocktime.c" />
     <ClCompile Include="..\..\..\..\libntp\clocktypes.c" />


=====================================
ports/winnt/vs2013/libntp/libntp.vcxproj.filters
=====================================
--- a/ports/winnt/vs2013/libntp/libntp.vcxproj.filters
+++ b/ports/winnt/vs2013/libntp/libntp.vcxproj.filters
@@ -50,12 +50,6 @@
     <ClCompile Include="..\..\..\..\lib\isc\buffer.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\..\..\libntp\calgregorian.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\..\..\libntp\caltontp.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\..\..\libntp\calyearstart.c">
       <Filter>Source Files</Filter>
     </ClCompile>


=====================================
tests/check_y2k.c
=====================================
--- a/tests/check_y2k.c
+++ b/tests/check_y2k.c
@@ -437,137 +437,6 @@ main( void )
    }
   }
 
-    puts( " libntp/calgregorian.c" );
-  {		/* test calgregorian() */
-    struct	calendar  ot;
-    u_long ntp_time;		/* NTP time */
-
-    year = year0;		/* calculate the basic year */
-    printf( "  starting year %04d\n", (int)year0 );
-    printf( "  ending year   %04d\n", (int)yearend );
-
-
-    ntp_time = julian0( year0 );		/* NTP starts in 1900-01-01 */
-#if DAY_NTP_STARTS == 693596
-    ntp_time -= 365;		/* BIAS required for successful test */
-#endif
-    if ( DAY_NTP_STARTS != ntp_time )
-    {
-	Error(year);
-	fprintf( stdout, 
-		"%04d: DAY_NTP_STARTS (%ld) NOT TRUE VALUE OF %ld (%ld)\n",
-		(int)year0,
-		(long)DAY_NTP_STARTS,  (long)ntp_time,
-		(long)DAY_NTP_STARTS - (long)ntp_time );
-    }
-
-    for ( ; year < yearend; year++ )
-    {
-	
-	/* 01-01 for the current year */
-	ntp_time = Days( year ) - Days( year0 );  /* days into NTP time */
-	ntp_time *= 24 * 60 * 60;	/* convert into seconds */
-	calgregorian( ntp_time, &ot );	/* convert January 1 */
-	if ( ot.year  != year
-	  || ot.month != 1
-	  || ot.monthday != 1 )
-	{
-	    Error(year);
-	    fprintf( stdout, "%lu: EXPECTED %04d-01-01: FOUND %04d-%02d-%02d\n",
-			(unsigned long)ntp_time,
-			year, 
-			(int)ot.year, (int)ot.month, (int)ot.monthday );
-	    break;
-	}
-
-	ntp_time += (31 + 28-1) * ( 24 * 60 * 60 );	/* advance to 02-28 */
-	calgregorian( ntp_time, &ot );	/* convert Feb 28 */
-	if ( ot.year  != year
-	  || ot.month != 2
-	  || ot.monthday != 28 )
-	{
-	    Error(year);
-	    fprintf( stdout, "%lu: EXPECTED %04d-02-28: FOUND %04d-%02d-%02d\n",
-			(unsigned long)ntp_time,
-			year, 
-			(int)ot.year, (int)ot.month, (int)ot.monthday );
-	    break;
-	}
-
-      {
-	int    m;		/* expected month */
-	int    d;		/* expected day */
-
-	m = isleap_4(year) ?  2 : 3;
-	d = isleap_4(year) ? 29 : 1;
-
-	ntp_time += ( 24 * 60 * 60 );	/* advance to the next day */
-	calgregorian( ntp_time, &ot );	/* convert this day */
-	if ( ot.year  != year
-	  || ot.month != m
-	  || ot.monthday != d )
-	{
-	    Error(year);
-	    fprintf( stdout, "%lu: EXPECTED %04d-%02d-%02d: FOUND %04d-%02d-%02d\n",
-			(unsigned long)ntp_time,
-			year, m, d, 
-			(int)ot.year, (int)ot.month, (int)ot.monthday );
-	    break;
-	}
-
-      }
-    }
-  }
-
-    puts( " libntp/caltontp.c" );
-  {		/* test caltontp() */
-    struct	calendar  ot;
-    u_long      ntp_time;		/* NTP time */
-
-    year = year0;		/* calculate the basic year */
-    printf( "  starting year %04d\n", (int)year0 );
-    printf( "  ending year   %04d\n", (int)yearend );
-
-
-    for ( ; year < yearend; year++ )
-    {
-	u_long  ObservedNtp;
-	
-	/* 01-01 for the current year */
-	ot.year = year;
-	ot.month = ot.monthday = 1; 	/* unused, but set anyway JIC */
-	ot.yearday = 1;		/* this is the magic value used by caltontp() */
-	ot.hour = ot.minute = ot.second = 0;
-
-	ntp_time = Days( year ) - Days( year0 );  /* days into NTP time */
-	ntp_time *= 24 * 60 * 60;	/* convert into seconds */
-	ObservedNtp = caltontp( &ot );
-	if ( ntp_time != ObservedNtp )
-	{
-	    Error(year);
-	    fprintf( stdout, "%d: EXPECTED %lu: FOUND %lu (%ld)\n",
-			(int)year,
-			(unsigned long)ntp_time, (unsigned long)ObservedNtp ,
-			(long)ntp_time - (long)ObservedNtp );
-
-	    break;
-	}
-
-	/* now call calgregorian as a type of failsafe supercheck */
-	calgregorian( ObservedNtp, &ot );	/* convert January 1 */
-	if ( ot.year  != year
-	  || ot.month != 1
-	  || ot.monthday != 1 )
-	{
-	    Error(year);
-	    fprintf( stdout, "%lu: calgregorian FAILSAFE EXPECTED %04d-01-01: FOUND %04d-%02d-%02d\n",
-			(unsigned long)ObservedNtp,
-			year, 
-			(int)ot.year, (int)ot.month, (int)ot.monthday );
-	    break;
-	}
-    }
-  }
 
    if ( Warnings > 0 )
        fprintf( stdout, "%d WARNINGS\n",  Warnings );


=====================================
tests/common/tests_main.c
=====================================
--- a/tests/common/tests_main.c
+++ b/tests/common/tests_main.c
@@ -42,8 +42,6 @@ static void RunAllTests(void)
 	RUN_TEST_GROUP(a_md5encrypt);
 	RUN_TEST_GROUP(authkeys);
 	RUN_TEST_GROUP(calendar);
-	RUN_TEST_GROUP(calgregorian);
-	RUN_TEST_GROUP(caltontp);
 	RUN_TEST_GROUP(calyearstart);
 	RUN_TEST_GROUP(clocktime);
 	RUN_TEST_GROUP(decodenetnum);


=====================================
tests/libntp/calgregorian.c deleted
=====================================
--- a/tests/libntp/calgregorian.c
+++ /dev/null
@@ -1,90 +0,0 @@
-#include "config.h"
-#include "ntp_stdlib.h"
-
-#include "unity.h"
-#include "unity_fixture.h"
-
-#include "ntp_calendar.h"
-
-#include <string.h>
-#include "caltime.h"
-
-TEST_GROUP(calgregorian);
-
-TEST_SETUP(calgregorian) {
-	ntpcal_set_timefunc(timefunc);
-	settime(1970, 1, 1, 0, 0, 0);
-}
-
-TEST_TEAR_DOWN(calgregorian) {
-	ntpcal_set_timefunc(NULL);
-}
-
-bool IsEqualC(const struct calendar *expected, const struct calendar *actual) {
-	if (expected->year == actual->year &&
-		(expected->yearday == actual->yearday ||
-		 (expected->month == actual->month &&
-		  expected->monthday == actual->monthday)) &&
-		expected->hour == actual->hour &&
-		expected->minute == actual->minute &&
-		expected->second == actual->second) {
-		return true;
-	} else {
-		/* coverity[leaked_storage] */
-		printf("expected: %s but was %s", CalendarToString(expected), CalendarToString(actual));
-
-		return false;
-	}
-}
-
-
-TEST(calgregorian, RegularTime) {
-	u_long testDate = 3485080800UL; // 2010-06-09 14:00:00
-	struct calendar expected = {2010, 160, 6, 9, 14, 0, 0, 0};
-
-	struct calendar actual;
-
-	calgregorian(testDate, &actual);
-
-	TEST_ASSERT_TRUE(IsEqualC(&expected, &actual));
-}
-
-TEST(calgregorian, LeapYear) {
-	u_long input = 3549902400UL; // 2012-06-28 20:00:00Z
-	struct calendar expected = {2012, 179, 6, 28, 20, 0, 0, 0};
-
-	struct calendar actual;
-
-	calgregorian(input, &actual);
-
-	TEST_ASSERT_TRUE(IsEqualC(&expected, &actual));
-}
-
-TEST(calgregorian, uLongBoundary) {
-	u_long time = 4294967295UL; // 2036-02-07 6:28:15
-	struct calendar expected = {2036, 0, 2, 7, 6, 28, 15, 0};
-
-	struct calendar actual;
-
-	calgregorian(time, &actual);
-
-	TEST_ASSERT_TRUE(IsEqualC(&expected, &actual));
-}
-
-TEST(calgregorian, uLongWrapped) {
-	u_long time = 0;
-	struct calendar expected = {2036,0,2,7,6,28,16, 0};
-
-	struct calendar actual;
-
-	calgregorian(time, &actual);
-
-	TEST_ASSERT_TRUE(IsEqualC(&expected, &actual));
-}
-
-TEST_GROUP_RUNNER(calgregorian) {
-	RUN_TEST_CASE(calgregorian, RegularTime);
-	RUN_TEST_CASE(calgregorian, LeapYear);
-	RUN_TEST_CASE(calgregorian, uLongBoundary);
-	RUN_TEST_CASE(calgregorian, uLongWrapped);
-}


=====================================
tests/libntp/caltontp.c deleted
=====================================
--- a/tests/libntp/caltontp.c
+++ /dev/null
@@ -1,64 +0,0 @@
-#include "config.h"
-#include "ntp_stdlib.h"
-
-#include "unity.h"
-#include "unity_fixture.h"
-
-#include "ntp_calendar.h"
-
-TEST_GROUP(caltontp);
-
-TEST_SETUP(caltontp) {}
-
-TEST_TEAR_DOWN(caltontp) {}
-
-
-
-
-TEST(caltontp, DateGivenMonthDay) {
-	// 2010-06-24 12:50:00
-	struct calendar input = {2010, 0, 6, 24, 12, 50, 0, 0};
-
-	u_long expected = 3486372600UL; // This is the timestamp above.
-
-	TEST_ASSERT_EQUAL(expected, caltontp(&input));
-}
-
-TEST(caltontp, DateGivenYearDay) {
-	// 2010-06-24 12:50:00
-	// This is the 175th day of 2010.
-	struct calendar input = {2010, 175, 0, 0, 12, 50, 0, 0};
-
-	u_long expected = 3486372600UL; // This is the timestamp above.
-
-	TEST_ASSERT_EQUAL(expected, caltontp(&input));
-}
-
-TEST(caltontp, DateLeapYear) {
-	// 2012-06-24 12:00:00
-	// This is the 176th day of 2012 (since 2012 is a leap year).
-	struct calendar inputYd = {2012, 176, 0, 0, 12, 00, 00, 0};
-	struct calendar inputMd = {2012, 0, 6, 24, 12, 00, 00, 0};
-
-	u_long expected = 3549528000UL;
-
-	TEST_ASSERT_EQUAL(expected, caltontp(&inputYd));
-	TEST_ASSERT_EQUAL(expected, caltontp(&inputMd));
-}
-
-TEST(caltontp, WraparoundDateIn2036) {
-	// 2036-02-07 06:28:16
-	// This is (one) wrapping boundary where we go from ULONG_MAX to 0.
-	struct calendar input = {2036, 0, 2, 7, 6, 28, 16, 0};
-
-	u_long expected = 0UL;
-
-	TEST_ASSERT_EQUAL(expected, caltontp(&input));
-}
-
-TEST_GROUP_RUNNER(caltontp) {
-	RUN_TEST_CASE(caltontp, DateGivenMonthDay);
-	RUN_TEST_CASE(caltontp, DateGivenYearDay);
-	RUN_TEST_CASE(caltontp, DateLeapYear);
-	RUN_TEST_CASE(caltontp, WraparoundDateIn2036);
-}


=====================================
tests/wscript
=====================================
--- a/tests/wscript
+++ b/tests/wscript
@@ -57,8 +57,6 @@ def build(ctx):
 		"libntp/a_md5encrypt.c",
 		"libntp/authkeys.c",
 		"libntp/calendar.c",
-		"libntp/calgregorian.c",
-		"libntp/caltontp.c",
 		"libntp/calyearstart.c",
 		"libntp/clocktime.c",
 		"libntp/decodenetnum.c",



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/7b60ba12a239a56cfdb178a63b422087c7a1a2b4...4ac4e5d774dbe54e17cb5ddb0dccba8e737d963d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160823/e9183708/attachment.html>


More information about the vc mailing list