[Git][NTPsec/ntpsec][master] 2 commits: Typo fixes in the BUILD file.
Eric S. Raymond
gitlab at mg.gitlab.com
Thu Dec 10 14:00:51 UTC 2015
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
0a01a366 by Eric S. Raymond at 2015-12-10T07:10:06Z
Typo fixes in the BUILD file.
- - - - -
4b306df6 by Eric S. Raymond at 2015-12-10T08:59:38Z
Port cleanup - move Mac shim for clock_gettime(2) to machines.c.
No logic changes.
- - - - -
4 changed files:
- INSTALL
- include/ntp_unixtime.h
- libntp/machines.c
- libntp/systime.c
Changes:
=====================================
INSTALL
=====================================
--- a/INSTALL
+++ b/INSTALL
@@ -132,7 +132,7 @@ Please report this as a bug, along with your platform details.
== Installation Names ==
-By default, `make install' will install the package's files in
+By default, `waf install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving waf the
option `--prefix=PATH'.
@@ -141,7 +141,7 @@ option `--prefix=PATH'.
Due to variations in Perl library paths, our stock source distribution
makes no attempt to install certain Perl scripts: notably
-ntpleapfetch, ntpwait, and ntptrace. If you installed this sotware
+ntpleapfetch, ntpwait, and ntptrace. If you installed this software
from a binary package prepared by your OS distributor, the OS
distributor may install them, arranging a rendezvous with the
Perl implementation's library path.
=====================================
include/ntp_unixtime.h
=====================================
--- a/include/ntp_unixtime.h
+++ b/include/ntp_unixtime.h
@@ -18,22 +18,15 @@
#define CLOCK_REALTIME 0
#define CLOCK_MONOTONIC 1
typedef int clockid_t;
-#endif
-
-#ifndef HAVE_CLOCK_GETTIME
-/*
- * Pacify platforms that don't have a real clock_gettime(2),
- * notably Mac OS X.
- */
int clock_gettime(clockid_t clock_id, struct timespec *tp);
#endif
/*
- * Time of day conversion constant. Ntp's time scale starts in 1900,
+ * Time of day conversion constant. NTP's time scale starts in 1900,
* Unix in 1970. The value is 1970 - 1900 in seconds, 0x83aa7e80 or
* 2208988800. This is larger than 32-bit INT_MAX, so unsigned
* type is forced.
*/
#define JAN_1970 ((u_int)NTP_TO_UNIX_DAYS * (u_int)SECSPERDAY)
-#endif /* GUARD_!defined(NTP_UNIXTIME_H) */
+#endif /* GUARD_NTP_UNIXTIME_H */
=====================================
libntp/machines.c
=====================================
--- a/libntp/machines.c
+++ b/libntp/machines.c
@@ -26,6 +26,57 @@
int _getch(void); /* Declare the one function rather than include conio.h */
#else
+/*
+ * 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>
+#elif HAVE_GETCLOCK
+#include <sys/timers.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;
+#elif HAVE_GETCLOCK
+ (void) getclock(TIMEOFDAY, &tp);
+#else
+#error Either POSIX clock_gettime(2) or Tru64/HP-UX getclock(2) is required
+/*
+ * Note: as a result of the refactoring of time handing, the support for
+ * compiling ntpdsim is currently broken. It used to have an intercept point
+ * in unixtime.h, these definitions:
+ #define GETTIMEOFDAY(a, b) (node_gettime(&ntp_node, a))
+ #define SETTIMEOFDAY(a, b) (node_settime(&ntp_node, a))
+ #define ADJTIMEOFDAY(a, b) (node_adjtime(&ntp_node, a, b))
+ * To work again it will need one here.
+ */
+#endif
+ return 0;
+}
+#endif /* HAVE_CLOCK_GETTIME */
+
#if !defined(HAVE_NTP_GETTIME) && defined(HAVE_NTP_ADJTIME)
int ntp_gettime(struct ntptimeval *ntv)
{
=====================================
libntp/systime.c
=====================================
--- a/libntp/systime.c
+++ b/libntp/systime.c
@@ -115,57 +115,6 @@ init_systime(void)
#ifndef SIM /* ntpsim.c has get_systime() and friends for sim */
-/*
- * 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>
-#elif HAVE_GETCLOCK
-#include <sys/timers.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;
-#elif HAVE_GETCLOCK
- (void) getclock(TIMEOFDAY, &tp);
-#else
-#error Either POSIX clock_gettime(2) or Tru64/HP-UX getclock(2) is required
-/*
- * Note: as a result of the refactoring of time handing, the support for
- * compiling ntpdsim is currently broken. It used to have an intercept point
- * in unixtime.h, these definitions:
- #define GETTIMEOFDAY(a, b) (node_gettime(&ntp_node, a))
- #define SETTIMEOFDAY(a, b) (node_settime(&ntp_node, a))
- #define ADJTIMEOFDAY(a, b) (node_adjtime(&ntp_node, a, b))
- * To work again it will need one here.
- */
-#endif
- return 0;
-}
-#endif /* HAVE_CLOCK_GETTIME */
-
void
get_ostime(
struct timespec * tsp
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/d1d089535954c1ce04633d08ef005eca86660b55...4b306df6aeac4c0243720bcb7316bb28220967a1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20151210/88989c9a/attachment.html>
More information about the vc
mailing list