[Git][NTPsec/ntpsec][master] Removed unused function humantime()

Matt Selsky gitlab at mg.gitlab.com
Tue Oct 17 06:30:43 UTC 2017


Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
5c222984 by Matt Selsky at 2017-10-17T02:23:35-04:00
Removed unused function humantime()

- - - - -


5 changed files:

- include/ntp_stdlib.h
- libntp/humandate.c
- tests/common/tests_main.c
- − tests/libntp/humandate.c
- tests/wscript


Changes:

=====================================
include/ntp_stdlib.h
=====================================
--- a/include/ntp_stdlib.h
+++ b/include/ntp_stdlib.h
@@ -110,7 +110,6 @@ extern	char *	estrdup_impl(const char *, const char *, int);
 
 
 extern	const char *	humanlogtime	(void);
-extern	const char *	humantime	(time_t);
 extern	const char * eventstr	(int);
 extern	const char * ceventstr	(int);
 extern	const char * res_match_flags(unsigned short);


=====================================
libntp/humandate.c
=====================================
--- a/libntp/humandate.c
+++ b/libntp/humandate.c
@@ -43,29 +43,4 @@ humanlogtime(void)
 #endif /* ENABLE_CLASSIC_MODE */
 
 	return bp;
-}
-
-
-/*
- * humantime() -- like humanlogtime() but without date, and with the
- *		  time to display given as an argument.
- */
-const char *
-humantime(
-	time_t cursec
-	)
-{
-	char *		bp;
-	struct tm	tmbuf, *tm;
-	
-	tm = localtime_r(&cursec, &tmbuf);
-	if (!tm)
-		return "--:--:--";
-
-	bp  = lib_getbuf();
-	
-	snprintf(bp, LIB_BUFLENGTH, "%02d:%02d:%02d",
-		 tm->tm_hour, tm->tm_min, tm->tm_sec);
-		
-	return bp;
-}
+}
\ No newline at end of file


=====================================
tests/common/tests_main.c
=====================================
--- a/tests/common/tests_main.c
+++ b/tests/common/tests_main.c
@@ -44,7 +44,6 @@ static void RunAllTests(void)
 	RUN_TEST_GROUP(clocktime);
 	RUN_TEST_GROUP(decodenetnum);
 	RUN_TEST_GROUP(hextolfp);
-	RUN_TEST_GROUP(humandate);
 	RUN_TEST_GROUP(lfpfunc);
 	RUN_TEST_GROUP(lfptostr);
 	RUN_TEST_GROUP(macencrypt);


=====================================
tests/libntp/humandate.c deleted
=====================================
--- a/tests/libntp/humandate.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "config.h"
-#include "ntp_stdlib.h"
-
-#include "unity.h"
-#include "unity_fixture.h"
-
-
-TEST_GROUP(humandate);
-
-TEST_SETUP(humandate) {}
-
-TEST_TEAR_DOWN(humandate) {}
-
-
-TEST(humandate, RegularTime) {
-	time_t sample = 1276601278;
-	char expected[255];
-
-	struct tm tmbuf;
-
-	struct tm* tm;
-	tm = localtime_r(&sample, &tmbuf);
-	TEST_ASSERT_NOT_NULL(tm);
-
-	snprintf(expected, 255, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
-
-	TEST_ASSERT_EQUAL_STRING(expected, humantime(sample));
-}
-
-TEST(humandate, CurrentTime) {
-	time_t sample;
-	char expected[255];
-
-	struct tm tmbuf;
-
-	time(&sample);
-
-	struct tm* tm;
-	tm = localtime_r(&sample, &tmbuf);
-	TEST_ASSERT_NOT_NULL(tm);
-
-	snprintf(expected, 255, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
-
-	TEST_ASSERT_EQUAL_STRING(expected, humantime(sample));
-}
-
-TEST_GROUP_RUNNER(humandate) {
-	RUN_TEST_CASE(humandate, RegularTime);
-	RUN_TEST_CASE(humandate, CurrentTime);
-}


=====================================
tests/wscript
=====================================
--- a/tests/wscript
+++ b/tests/wscript
@@ -36,7 +36,6 @@ def build(ctx):
         "libntp/clocktime.c",
         "libntp/decodenetnum.c",
         "libntp/hextolfp.c",
-        "libntp/humandate.c",
         "libntp/lfpfunc.c",
         "libntp/lfptostr.c",
         "libntp/macencrypt.c",



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/5c2229840bdffb9652878a74aaf4b6b7784b686c

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/5c2229840bdffb9652878a74aaf4b6b7784b686c
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20171017/0b98bbf5/attachment.html>


More information about the vc mailing list