[Git][NTPsec/ntpsec][master] 2 commits: normalize_time(): no need to be extern, make it static.

Gary E. Miller gitlab at mg.gitlab.com
Fri Mar 10 02:58:13 UTC 2017


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


Commits:
95b098c2 by Gary E. Miller at 2017-03-09T17:42:50-08:00
normalize_time(): no need to be extern, make it static.

- - - - -
f69f6eae by Gary E. Miller at 2017-03-09T18:56:48-08:00
Do we need to test a flag if true to set it to false?

Seriously???
        if (lamport_violated)
                lamport_violated = false;

- - - - -


2 changed files:

- include/ntp_fp.h
- libntp/systime.c


Changes:

=====================================
include/ntp_fp.h
=====================================
--- a/include/ntp_fp.h
+++ b/include/ntp_fp.h
@@ -199,7 +199,6 @@ extern	char *	rfc3339date	(const l_fp);
 
 extern	void	set_sys_fuzz	(double);
 extern  void	get_ostime	(struct timespec *tsp);
-extern	void	normalize_time	(struct timespec, long, l_fp *);
 extern	void	get_systime	(l_fp *);
 extern	bool	step_systime	(double, int (*settime)(struct timespec *));
 extern	bool	adj_systime	(double, int (*adjtime)(const struct timeval *, struct timeval *));


=====================================
libntp/systime.c
=====================================
--- a/libntp/systime.c
+++ b/libntp/systime.c
@@ -112,20 +112,9 @@ get_ostime(
 }
 
 
-/*
- * get_systime - return system time in NTP timestamp format.
- */
-void
-get_systime(
-	l_fp *now		/* system time */
-	)
-{
-	struct timespec ts;	/* seconds and nanoseconds */
-	get_ostime(&ts);
-	normalize_time(ts, sys_fuzz > 0.0 ? ntp_random() : 0, now);
-}
+static	void	normalize_time	(struct timespec, long, l_fp *);
 
-void
+static void
 normalize_time(
 	struct timespec ts,		/* seconds and nanoseconds */
 	long rand,
@@ -217,11 +206,23 @@ normalize_time(
 	}
 	lfp_prev = result;
 	dfuzz_prev = dfuzz;
-	if (lamport_violated)
-		lamport_violated = false;
+	lamport_violated = false;
 	*now = result;
 }
 
+/*
+ * get_systime - return system time in NTP timestamp format.
+ */
+void
+get_systime(
+	l_fp *now		/* system time */
+	)
+{
+	struct timespec ts;	/* seconds and nanoseconds */
+	get_ostime(&ts);
+	normalize_time(ts, sys_fuzz > 0.0 ? ntp_random() : 0, now);
+}
+
 
 /*
  * adj_systime - adjust system time by the argument.



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/c7043d17c618971fb6edf8a564c1fe665e9e6a54...f69f6eaee8bb388c12b767a84da28f55ecd1aa7e
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170310/1dec7a0b/attachment.html>


More information about the vc mailing list