[Git][NTPsec/ntpsec][master] 2 commits: Typos/grammar
Eric S. Raymond
gitlab at mg.gitlab.com
Sun Oct 2 14:05:28 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
4bcafed7 by Matt Selsky at 2016-10-02T10:03:20-04:00
Typos/grammar
- - - - -
8c3600ae by Eric S. Raymond at 2016-10-02T10:04:47-04:00
Remove dead code for unused struct timeval operations.
- - - - -
5 changed files:
- devel/hacking.txt
- docs/includes/ntpviz-body.txt
- include/timevalops.h
- ntpstats/ntpviz
- tests/libntp/timevalops.c
Changes:
=====================================
devel/hacking.txt
=====================================
--- a/devel/hacking.txt
+++ b/devel/hacking.txt
@@ -477,7 +477,7 @@ This is the release checklist to be used by the project manager to cut each 0.9.
. Email a warning message to the devel list, and ask each of the major
contributors to chime in, and to each assure that the .../NEWS file
- and the ../deve/TODO file is up to date.
+ and the ../devel/TODO file is up to date.
. Wait 4 days for the contributors to check in and for the discussion
to settle down. If the discussion suggests that now is not a good
=====================================
docs/includes/ntpviz-body.txt
=====================================
--- a/docs/includes/ntpviz-body.txt
+++ b/docs/includes/ntpviz-body.txt
@@ -43,7 +43,7 @@ yyyy-mmm-ddThh:mm:ss. Alternatively you can specify either -s or -e
(but not both) and use -p to set the default period in days. The
default is for the period to be 7 days, the end time to match the last
logfile entry, and the start time to be set so that adding the period
-just reaches the last logfile entry. The arugment with -p may be a
+just reaches the last logfile entry. The argument with -p may be a
floating point number.
The -D N set the debug level to N and outputs with more verbosity. 0
=====================================
include/timevalops.h
=====================================
--- a/include/timevalops.h
+++ b/include/timevalops.h
@@ -5,6 +5,8 @@
*
* For a rationale look at 'timespecops.h'; we do the same here, but the
* normalisation keeps the microseconds in [0 .. 10^6], of course.
+ * NTPsec implements fewer operations here as we are trying to do as
+ * much arithmetic as possible in nanoseconds for code-hygiene reasons.
*
* Copyright 2015 by the NTPsec project contributors
* SPDX-License-Identifier: NTP
@@ -86,12 +88,6 @@
#define timeval_isnormal(x) \
((x)->tv_usec >= 0 && (x)->tv_usec < MICROSECONDS)
-/*
- * predicate: returns true if the microseconds are out-of-bounds
- * use like: int timeval_isdenormal(const struct timeval *x)
- */
-#define timeval_isdenormal(x) (!timeval_isnormal(x))
-
/* make sure microseconds are in nominal range */
static inline struct timeval
normalize_tval(
@@ -101,7 +97,7 @@ normalize_tval(
long z;
/*
- * If the fraction becomes excessive denormal, we use division
+ * If the fraction becomes excessively denormal, we use division
* to do first partial normalisation. The normalisation loops
* following will do the remaining cleanup. Since the size of
* tv_usec has a peculiar definition by the standard the range
@@ -152,21 +148,6 @@ add_tval(
return normalize_tval(x);
}
-/* x = a + b, b is fraction only */
-static inline struct timeval
-add_tval_us(
- struct timeval a,
- long b
- )
-{
- struct timeval x;
-
- x = a;
- x.tv_usec += b;
-
- return normalize_tval(x);
-}
-
/* x = a - b */
static inline struct timeval
sub_tval(
@@ -183,35 +164,6 @@ sub_tval(
return normalize_tval(x);
}
-/* x = a - b, b is fraction only */
-static inline struct timeval
-sub_tval_us(
- struct timeval a,
- long b
- )
-{
- struct timeval x;
-
- x = a;
- x.tv_usec -= b;
-
- return normalize_tval(x);
-}
-
-/* x = -a */
-static inline struct timeval
-neg_tval(
- struct timeval a
- )
-{
- struct timeval x;
-
- x.tv_sec = -a.tv_sec;
- x.tv_usec = -a.tv_usec;
-
- return normalize_tval(x);
-}
-
/* x = abs(a) */
static inline struct timeval
abs_tval(
@@ -284,27 +236,6 @@ test_tval(
return r;
}
-/*
- * test possibly-denormal a
- * return 1 / 0 / -1 if a < / == / > 0
- */
-static inline int
-test_tval_denorm(
- struct timeval a
- )
-{
- return test_tval(normalize_tval(a));
-}
-
-/* return LIB buffer ptr to string rep */
-static inline const char *
-tvaltoa(
- struct timeval x
- )
-{
- return format_time_fraction(x.tv_sec, x.tv_usec, 6);
-}
-
/* convert from timeval duration to l_fp duration */
static inline l_fp
tval_intv_to_lfp(
@@ -361,45 +292,4 @@ lfp_intv_to_tval(
return out;
}
-static inline struct timeval
-lfp_uintv_to_tval(
- l_fp x
- )
-{
- struct timeval out;
-
- TSFTOTVU(x.l_uf, out.tv_usec);
- out.tv_sec = x.l_ui;
-
- return out;
-}
-
-/*
- * absolute (timestamp) conversion. Input is time in NTP epoch, output
- * is in UN*X epoch. The NTP time stamp will be expanded around the
- * pivot time *p or the current time, if p is NULL.
- */
-static inline struct timeval
-lfp_stamp_to_tval(
- l_fp x,
- const time_t * p
- )
-{
- struct timeval out;
- vint64 sec;
-
- sec = ntpcal_ntp_to_time(x.l_ui, p);
- TSFTOTVU(x.l_uf, out.tv_usec);
-
- /* copying a vint64 to a time_t needs some care... */
-#if SIZEOF_TIME_T <= 4
- out.tv_sec = (time_t)vint64lo(sec);
-#else
- out.tv_sec = (time_t)vint64s(sec);
-#endif
- out = normalize_tval(out);
-
- return out;
-}
-
#endif /* GUARD_TIMEVALOPS_H */
=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -533,7 +533,7 @@ see how the measured offset is changing.</p>
<p>The chart also plots offset±rtt. Where rtt is the round trip time
to the remote. NTP can not really know the offset of a remote chimer,
NTP computes it by subtracting rtt/2 from the offset. Plotting the
-offset±rtt reverses this calculation to easier see the effects of
+offset±rtt reverses this calculation to more easily see the effects of
rtt changes.</p>
"""
=====================================
tests/libntp/timevalops.c
=====================================
--- a/tests/libntp/timevalops.c
+++ b/tests/libntp/timevalops.c
@@ -314,36 +314,6 @@ TEST(timevalops, AddFullOflow1) {
return;
}
-TEST(timevalops, AddUsecNorm) {
- int i;
-
- for (i = -4; i <= 4; ++i) {
- struct timeval a = timeval_init(i, 200);
- struct timeval E = timeval_init(i, 600);
- struct timeval c;
-
- c = add_tval_us(a, 600 - 200);
- TEST_ASSERT_EQUAL_timeval(E, c);
- }
-
- return;
-}
-
-TEST(timevalops, AddUsecOflow1) {
- int i;
-
- for (i = -4; i <= 4; ++i) {
- struct timeval a = timeval_init(i, 200);
- struct timeval E = timeval_init(i + 1, 100);
- struct timeval c;
-
- c = add_tval_us(a, MICROSECONDS - 100);
- TEST_ASSERT_EQUAL_timeval(E, c);
- }
-
- return;
-}
-
//----------------------------------------------------------------------
// test subtraction (difference)
//----------------------------------------------------------------------
@@ -382,56 +352,6 @@ TEST(timevalops, SubFullOflow) {
return;
}
-TEST(timevalops, SubUsecNorm) {
- int i = -4;
-
- for (i = -4; i <= 4; ++i) {
- struct timeval a = timeval_init(i, 600);
- struct timeval E = timeval_init(i, 200);
- struct timeval c;
-
- c = sub_tval_us(a, 600 - 200);
- TEST_ASSERT_EQUAL_timeval(E, c);
- }
-
- return;
-}
-
-TEST(timevalops, SubUsecOflow) {
- int i = -4;
-
- for (i = -4; i <= 4; ++i) {
- struct timeval a = timeval_init(i, 100);
- struct timeval E = timeval_init(i - 1, 200);
- struct timeval c;
-
- c = sub_tval_us(a, MICROSECONDS - 100);
- TEST_ASSERT_EQUAL_timeval(E, c);
- }
-
- return;
-}
-
-//----------------------------------------------------------------------
-// test negation
-//----------------------------------------------------------------------
-
-TEST(timevalops, Neg) {
- int i = -4;
-
- for (i = -4; i <= 4; ++i) {
- struct timeval a = timeval_init(i, 100);
- struct timeval b;
- struct timeval c;
-
- b = neg_tval(a);
- c = add_tval(a, b);
- TEST_ASSERT_EQUAL(0, test_tval(c));
- }
-
- return;
-}
-
//----------------------------------------------------------------------
// test abs value
//----------------------------------------------------------------------
@@ -650,39 +570,6 @@ TEST(timevalops, LFProundtrip) {
return;
}
-//----------------------------------------------------------------------
-// string formatting
-//----------------------------------------------------------------------
-
-TEST(timevalops, ToString) {
- static const struct {
- time_t sec;
- long usec;
- const char * repr;
- } data [] = {
- { 0, 0, "0.000000" },
- { 2, 0, "2.000000" },
- {-2, 0, "-2.000000" },
- { 0, 1, "0.000001" },
- { 0,-1, "-0.000001" },
- { 1,-1, "0.999999" },
- {-1, 1, "-0.999999" },
- {-1,-1, "-1.000001" },
- };
- int i;
-
- for (i = 0; i < (int)COUNTOF(data); ++i) {
- struct timeval a = timeval_init(data[i].sec, data[i].usec);
- const char * E = data[i].repr;
- const char * r = tvaltoa(a);
-
- TEST_ASSERT_EQUAL_STRING(E, r);
- }
-
- return;
-}
-
-
TEST_GROUP_RUNNER(timevalops) {
RUN_TEST_CASE(timevalops, Helpers1);
RUN_TEST_CASE(timevalops, Normalise);
@@ -693,13 +580,8 @@ TEST_GROUP_RUNNER(timevalops) {
RUN_TEST_CASE(timevalops, CmpFracLT);
RUN_TEST_CASE(timevalops, AddFullNorm);
RUN_TEST_CASE(timevalops, AddFullOflow1);
- RUN_TEST_CASE(timevalops, AddUsecNorm);
- RUN_TEST_CASE(timevalops, AddUsecOflow1);
RUN_TEST_CASE(timevalops, SubFullNorm);
RUN_TEST_CASE(timevalops, SubFullOflow);
- RUN_TEST_CASE(timevalops, SubUsecNorm);
- RUN_TEST_CASE(timevalops, SubUsecOflow);
- RUN_TEST_CASE(timevalops, Neg);
RUN_TEST_CASE(timevalops, AbsNoFrac);
RUN_TEST_CASE(timevalops, AbsWithFrac);
/* RUN_TEST_CASE(timevalops, Helpers2); */
@@ -711,7 +593,6 @@ TEST_GROUP_RUNNER(timevalops) {
RUN_TEST_CASE(timevalops, FromLFPrelPos);
RUN_TEST_CASE(timevalops, FromLFPrelNeg);
RUN_TEST_CASE(timevalops, LFProundtrip);
- RUN_TEST_CASE(timevalops, ToString);
}
// -*- EOF -*-
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/dd83224ef702b8cc5fc31cd9c36112dac136f045...8c3600aef74b39401f0ab2a9d171ccf78c749e3f
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161002/b9ef31d6/attachment.html>
More information about the vc
mailing list