[Git][NTPsec/ntpsec][master] 2 commits: Actually remove libntp/machines.c, correcting an earlier finger error.
Eric S. Raymond
gitlab at mg.gitlab.com
Thu Nov 10 13:00:20 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
920b7c8d by Eric S. Raymond at 2016-11-10T07:56:30-05:00
Actually remove libntp/machines.c, correcting an earlier finger error.
- - - - -
1ebe9cd5 by Eric S. Raymond at 2016-11-10T07:59:09-05:00
Move msyslog.c to sgarables - clockwark.c turns out to need it.
- - - - -
2 changed files:
- − libntp/machines.c
- libntp/wscript
Changes:
=====================================
libntp/machines.c deleted
=====================================
--- a/libntp/machines.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* machines.c - provide special support for peculiar architectures
- *
- * Real bummers unite !
- *
- */
-
-#include <unistd.h>
-
-#include "config.h"
-
-#ifdef HAVE_SYS_TIMEX_H
-# include <sys/time.h> /* prerequisite on NetBSD */
-# include <sys/timex.h>
-#endif
-
-#include "ntp.h"
-#include "ntp_machine.h"
-#include "ntp_syslog.h"
-#include "ntp_stdlib.h"
-#include "lib_strbuf.h"
-#include "ntp_debug.h"
-#include "ntp_syscall.h"
-
-/*
- * Simulate ANSI/POSIX conformance on platforms that don't have it
- */
-#ifndef HAVE_CLOCK_GETTIME
-#ifdef __MACH__
-#include <mach/clock.h>
-#include <mach/mach.h>
-#endif
-
-int clock_gettime(clockid_t clk_id, struct timespec *tp)
-{
-#ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
- clock_serv_t cclock;
- mach_timespec_t mts;
- int mode;
- switch (clk_id) {
- case CLOCK_REALTIME:
- mode = CALENDAR_CLOCK;
- break;
- case CLOCK_MONOTONIC:
- /* http://stackoverflow.com/questions/11680461/monotonic-clock-on-osx */
- mode = SYSTEM_CLOCK;
- break;
- default:
- return -1;
- }
- host_get_clock_service(mach_host_self(), mode, &cclock);
- clock_get_time(cclock, &mts);
- mach_port_deallocate(mach_task_self(), cclock);
- tp->tv_sec = mts.tv_sec;
- tp->tv_nsec = mts.tv_nsec;
-#else
-#error POSIX clock_gettime(2) is required
-#endif
- return 0;
-}
-#endif /* HAVE_CLOCK_GETTIME */
-
-#ifdef HAVE_SYS_TIMEX_H
-/*
- * ntp_adjtime at nanosecond precision. Hiding the units difference
- * here helps prevent loss-of-precision bugs elsewhere. We
- * deliberately don't merge STA_NANO into the status flags if it's
- * absent, however, this way callers can tell what accuracy they're
- * actually getting.
- *
- * Some versions of ntp_adtime(2), notably the Linux one which is
- * implemented in terms of a local, unstandardized adjtimex(2), have a
- * time member that can be used to retrieve and increment
- * (ADJ_SETOFFSET) system time. If this were portable there would be
- * scaling of ntx->time.tv_usec in here for non-STA_NANO systems. It
- * isn't; NetBSD and FreeBSD don't have that time member.
- *
- * Problem: the Linux manual page for adjtimex(2) says the precision
- * member is microseconds and doesn't mention STA_NANO, but the legacy
- * ntptime code has a scaling expression in it that implies
- * nanoseconds if that flash bit is on. It is unknown under what
- * circumstances, if any, this was ever correct.
- */
-int ntp_adjtime_ns(struct timex *ntx)
-{
-#ifdef STA_NANO
- static bool nanoseconds = false;
- static int callcount = 0;
- if (callcount++ == 0){
- struct timex ztx;
- memset(&ztx, '\0', sizeof(ztx));
- ntp_adjtime(&ztx);
- nanoseconds = (STA_NANO & ztx.status) != 0;
- }
-#endif
-
-#ifdef STA_NANO
- if (!nanoseconds)
-#endif
- ntx->offset /= 1000;
- int errval = ntp_adjtime(ntx);
-#ifdef STA_NANO
- nanoseconds = (STA_NANO & ntx->status) != 0;
- if (!nanoseconds)
-#endif
- {
- ntx->offset *= 1000;
- //ntx->precision *= 1000;
- ntx->jitter *= 1000;
- }
- return errval;
-}
-#endif /* HAVE_SYS_TIMEX_H */
-
-#if !defined(HAVE_NTP_GETTIME) && defined(HAVE_NTP_ADJTIME)
-int ntp_gettime(struct ntptimeval *ntv)
-{
- struct timex tntx;
- int result;
-
- ZERO(tntx);
- result = ntp_adjtime(&tntx);
- ntv->time = tntx.time;
- ntv->maxerror = tntx.maxerror;
- ntv->esterror = tntx.esterror;
-# ifdef NTP_API
-# if NTP_API > 3
- ntv->tai = tntx.tai;
-# endif
-# endif
- return result;
-}
-#endif /* !HAVE_NTP_GETTIME */
-
-int
-ntp_set_tod(
- struct timespec *tvs
- )
-{
- int rc;
- int saved_errno;
-
- TRACE(1, ("In ntp_set_tod\n"));
-#ifdef HAVE_CLOCK_SETTIME
- errno = 0;
- rc = clock_settime(CLOCK_REALTIME, tvs);
- saved_errno = errno;
- TRACE(1, ("ntp_set_tod: clock_settime: %d %m\n", rc));
-#else
-#error POSIX clock_gettime(2) is required
-#endif /* HAVE_CLOCK_SETTIME */
- errno = saved_errno; /* for %m below */
- TRACE(1, ("ntp_set_tod: Final result: clock_settime: %d %m\n", rc));
-
- if (rc)
- errno = saved_errno;
-
- return rc;
-}
-
=====================================
libntp/wscript
=====================================
--- a/libntp/wscript
+++ b/libntp/wscript
@@ -17,7 +17,6 @@ def build(ctx):
"initnetwork.c",
"md5.c",
"mstolfp.c",
- "msyslog.c",
"netof.c",
"ntp_endian.c",
"ntp_intres.c",
@@ -42,6 +41,7 @@ def build(ctx):
"hextolfp.c",
"humandate.c",
"lib_strbuf.c",
+ "msyslog.c",
"ntp_calendar.c",
"prettydate.c",
"statestr.c",
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/7d4f63797ce42e560f632375ea4b68d299a938f3...1ebe9cd52a5d27f55cac4aa393c0799e4b7d2bbd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161110/e1d0db2c/attachment.html>
More information about the vc
mailing list