[Git][NTPsec/ntpsec][master] 4 commits: libntp: make ntpcal_ntp64_to_date() static

Gary E. Miller gitlab at mg.gitlab.com
Mon May 22 22:23:26 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
dd0eec6a by Gary E. Miller at 2017-05-22T14:48:33-07:00
libntp: make ntpcal_ntp64_to_date() static

- - - - -
f1b8ff48 by Gary E. Miller at 2017-05-22T15:13:40-07:00
libntp: make ntpcal_days_in_months() static

- - - - -
5f5f21fd by Gary E. Miller at 2017-05-22T15:16:32-07:00
libntp: remove unused function: ntpcal_daysplit_to_date()

- - - - -
7a0d87b5 by Gary E. Miller at 2017-05-22T15:18:22-07:00
libntp: remove unused function: ntpcal_daysec_to_tm()

- - - - -


2 changed files:

- include/ntp_calendar.h
- libntp/ntp_calendar.c


Changes:

=====================================
include/ntp_calendar.h
=====================================
--- a/include/ntp_calendar.h
+++ b/include/ntp_calendar.h
@@ -99,19 +99,6 @@ extern int32_t
 ntpcal_days_in_years(int32_t /* years */) __attribute__((const));
 
 /*
- * Convert a number of elapsed month in a year into elapsed days
- * in year.
- *
- * The month will be normalized, and 'res.hi' will contain the
- * excessive years that must be considered when converting the years,
- * while 'res.lo' will contain the days since start of the
- * year. (Expect the resulting days to be negative, with a positive
- * excess! But then, we need no leap year flag, either...)
- */
-extern ntpcal_split
-ntpcal_days_in_months(int32_t /* months */);
-
-/*
  * Convert ELAPSED years/months/days of gregorian calendar to elapsed
  * days in Gregorian epoch. No range checks done here!
  */
@@ -193,21 +180,10 @@ ntpcal_daysec_to_date(struct calendar * /* jt */, int32_t /* secs */);
 extern int32_t
 ntpcal_date_to_daysec(const struct calendar *);
 
-/*
- * Take a value of seconds since midnight and split it into hhmmss in
- * a 'struct tm'. Return excessive days.
- */
-extern int32_t
-ntpcal_daysec_to_tm(struct tm * /* utm */, int32_t /* secs */);
-
 extern int32_t
 ntpcal_tm_to_daysec(const struct tm * /* utm */);
 
 extern int
-ntpcal_daysplit_to_date(struct calendar * /* jt */,
-			const ntpcal_split * /* ds */, int32_t /* dof */);
-
-extern int
 ntpcal_time_to_date(struct calendar * /* jd */, const time64_t /* ts */);
 
 extern int32_t
@@ -215,9 +191,6 @@ ntpcal_periodic_extend(int32_t /* pivot */, int32_t /* value */,
 		       int32_t /* cycle */) __attribute__((const));
 
 extern int
-ntpcal_ntp64_to_date(struct calendar * /* jd */, const time64_t /* ntp */);
-
-extern int
 ntpcal_ntp_to_date(struct calendar * /* jd */,	uint32_t /* ntp */,
 		   const time_t * /* pivot */);
 


=====================================
libntp/ntp_calendar.c
=====================================
--- a/libntp/ntp_calendar.c
+++ b/libntp/ntp_calendar.c
@@ -25,6 +25,12 @@
 static systime_func_ptr systime_func = &time;
 static inline time_t now(void);
 
+static int
+ntpcal_ntp64_to_date(struct calendar * /* jd */, const time64_t /* ntp */);
+
+static ntpcal_split
+ntpcal_days_in_months(int32_t /* months */);
+
 
 systime_func_ptr
 ntpcal_set_timefunc(
@@ -563,50 +569,6 @@ ntpcal_daysec_to_date(
 
 /*
  *---------------------------------------------------------------------
- * Take a value of seconds since midnight and split it into hhmmss in a
- * 'struct tm'.
- *---------------------------------------------------------------------
- */
-int32_t
-ntpcal_daysec_to_tm(
-	struct tm *utm,
-	int32_t	   sec
-	)
-{
-	int32_t days;
-	int32_t ts[3];
-
-	days = priv_timesplit(ts, sec);
-	utm->tm_hour = ts[0];
-	utm->tm_min  = ts[1];
-	utm->tm_sec  = ts[2];
-
-	return days;
-}
-
-/*
- *---------------------------------------------------------------------
- * take a split representation for day/second-of-day and day offset
- * and convert it to a 'struct calendar'. The seconds will be normalised
- * into the range of a day, and the day will be adjusted accordingly.
- *
- * returns >0 if the result is in a leap year, 0 if in a regular
- * year and <0 if the result did not fit into the calendar struct.
- *---------------------------------------------------------------------
- */
-int
-ntpcal_daysplit_to_date(
-	struct calendar	   *jd,
-	const ntpcal_split *ds,
-	int32_t		    dof
-	)
-{
-	dof += ntpcal_daysec_to_date(jd, ds->lo);
-	return ntpcal_rd_to_date(jd, ds->hi + dof);
-}
-
-/*
- *---------------------------------------------------------------------
  * Take a UN*X time and convert to a calendar structure.
  *---------------------------------------------------------------------
  */
@@ -709,7 +671,7 @@ ntpcal_days_in_years(
  * conversion is then simply based on the start of the following year.
  *---------------------------------------------------------------------
  */
-ntpcal_split
+static ntpcal_split
 ntpcal_days_in_months(
 	int32_t m
 	)
@@ -908,7 +870,7 @@ ntpcal_date_to_time(
 }
 
 
-int
+static int
 ntpcal_ntp64_to_date(
 	struct calendar *jd,
 	const time64_t  ntp



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/0bc7e25b67f3ff1856d7cfbc75d49310cafc0de6...7a0d87b5372e54f3d1af99697e21dd275c226a8d

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/0bc7e25b67f3ff1856d7cfbc75d49310cafc0de6...7a0d87b5372e54f3d1af99697e21dd275c226a8d
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/20170522/96938faf/attachment.html>


More information about the vc mailing list