aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/xntpd
diff options
context:
space:
mode:
authorDaniel O'Callaghan <danny@FreeBSD.org>1999-01-12 19:37:32 +0000
committerDaniel O'Callaghan <danny@FreeBSD.org>1999-01-12 19:37:32 +0000
commit482e17399aaf2753f1550c3c7d4f42e795a996b8 (patch)
treef3e9be8dfabef71fe1437ded4d8a74ff0cb31ea4 /usr.sbin/xntpd
parent02b1a04fd5e32ef73c7d1b57a0f47defe03bab0a (diff)
Notes
Diffstat (limited to 'usr.sbin/xntpd')
-rw-r--r--usr.sbin/xntpd/parse/util/dcfd.c10
-rw-r--r--usr.sbin/xntpd/parse/util/testdcf.c3
2 files changed, 9 insertions, 4 deletions
diff --git a/usr.sbin/xntpd/parse/util/dcfd.c b/usr.sbin/xntpd/parse/util/dcfd.c
index 38980714eb2b..0acfa72a1b9d 100644
--- a/usr.sbin/xntpd/parse/util/dcfd.c
+++ b/usr.sbin/xntpd/parse/util/dcfd.c
@@ -68,7 +68,7 @@ MUST DEFINE ONE OF "HAVE_TERMIOS" or "HAVE_TERMIO"
#endif
#ifndef dysize
-#define dysize(_x_) (((_x_) % 4) ? 365 : (((_x_) % 400) ? 365 : 366))
+#define dysize(_x_) (((_x_) % 4) ? 365 : (((_x_) % 100) ? 366 : ((_x_) % 400 ? 365 : 366 )))
#endif
#define timernormalize(_a_) \
@@ -761,7 +761,8 @@ dcf_to_unixtime(clock, cvtrtc)
*/
t = (clock->year - 1970) * 365;
t += (clock->year >> 2) - (1970 >> 2);
- t -= clock->year / 400 - 1970 / 400;
+ t -= clock->year / 100 - 1970 / 100;
+ t += clock->year / 400 - 1970 / 400;
/* month */
if (clock->month <= 0 || clock->month > 12)
@@ -1587,9 +1588,10 @@ main(argc, argv)
-tt.tv_usec;
/*
- * output interpreted DCF77 data
+ * output interpreted DCF77 data. DCF77 gives us a YY year
+ * but dcf_to_unixtime() adds the century, so print YYYY.
*/
- PRINTF(offsets ? "%s, %2d:%02d:%02d, %d.%02d.%02d, <%s%s%s%s> (%c%d.%06ds)" :
+ PRINTF(offsets ? "%s, %2d:%02d:%02d, %d.%02d.%4d, <%s%s%s%s> (%c%d.%06ds)" :
"%s, %2d:%02d:%02d, %d.%02d.%02d, <%s%s%s%s>",
wday[clock.wday],
clock.hour, clock.minute, i, clock.day, clock.month,
diff --git a/usr.sbin/xntpd/parse/util/testdcf.c b/usr.sbin/xntpd/parse/util/testdcf.c
index 219b7c3975b9..bd5ea88506d0 100644
--- a/usr.sbin/xntpd/parse/util/testdcf.c
+++ b/usr.sbin/xntpd/parse/util/testdcf.c
@@ -451,6 +451,9 @@ main(argc, argv)
if (rtc == CVT_OK)
{
+ /* We are only supplied two digits of the year, by the
+ * clock, so we'll just print two digits.
+ */
printf("%s, %2d:%02d:%02d, %d.%02d.%02d, <%s%s%s%s>",
wday[clock.wday],
(int)clock.hour, (int)clock.minute, (int)i, (int)clock.day, (int)clock.month,