summaryrefslogtreecommitdiffstats
path: root/usr.sbin/timed
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/timed')
-rw-r--r--usr.sbin/timed/timed/master.c12
-rw-r--r--usr.sbin/timed/timed/slave.c14
2 files changed, 17 insertions, 9 deletions
diff --git a/usr.sbin/timed/timed/master.c b/usr.sbin/timed/timed/master.c
index e36fbae..0537016 100644
--- a/usr.sbin/timed/timed/master.c
+++ b/usr.sbin/timed/timed/master.c
@@ -44,6 +44,7 @@ static const char rcsid[] =
#include <sys/types.h>
#include <sys/times.h>
#include <setjmp.h>
+#include <utmpx.h>
#include "pathnames.h"
extern int measure_delta;
@@ -56,8 +57,6 @@ static int slvcount; /* slaves listening to our clock */
static void mchgdate(struct tsp *);
-extern void logwtmp(char *, char *, char *);
-
/*
* The main function of `master' is to periodically compute the differences
* (deltas) between its clock and the clocks of the slaves, to compute the
@@ -350,6 +349,7 @@ mchgdate(msg)
char tname[MAXHOSTNAMELEN];
char olddate[32];
struct timeval otime, ntime, tmptv;
+ struct utmpx utx;
(void)strcpy(tname, msg->tsp_name);
@@ -371,9 +371,13 @@ mchgdate(msg)
dictate = 3;
synch(tvtomsround(ntime));
} else {
- logwtmp("|", "date", "");
+ utx.ut_type = OLD_TIME;
+ gettimeofday(&utx.ut_tv, NULL);
+ pututxline(&utx);
(void)settimeofday(&tmptv, 0);
- logwtmp("{", "date", "");
+ utx.ut_type = NEW_TIME;
+ gettimeofday(&utx.ut_tv, NULL);
+ pututxline(&utx);
spreadtime();
}
diff --git a/usr.sbin/timed/timed/slave.c b/usr.sbin/timed/timed/slave.c
index 217fd82..74a1723 100644
--- a/usr.sbin/timed/timed/slave.c
+++ b/usr.sbin/timed/timed/slave.c
@@ -41,6 +41,7 @@ static const char rcsid[] =
#include "globals.h"
#include <setjmp.h>
+#include <utmpx.h>
#include "pathnames.h"
extern jmp_buf jmpenv;
@@ -57,8 +58,6 @@ static void schgdate(struct tsp *, char *);
static void setmaster(struct tsp *);
static void answerdelay(void);
-extern void logwtmp(char *, char *, char *);
-
int
slave()
{
@@ -80,6 +79,7 @@ slave()
char newdate[32];
struct netinfo *ntp;
struct hosttbl *htp;
+ struct utmpx utx;
old_slavenet = 0;
@@ -280,9 +280,13 @@ loop:
*/
synch(tvtomsround(ntime));
} else {
- logwtmp("|", "date", "");
- (void)settimeofday(&tmptv, 0);
- logwtmp("{", "date", "");
+ utx.ut_type = OLD_TIME;
+ gettimeofday(&utx.ut_tv, NULL);
+ pututxline(&utx);
+ (void)settimeofday(&tmptv, 0);
+ utx.ut_type = NEW_TIME;
+ gettimeofday(&utx.ut_tv, NULL);
+ pututxline(&utx);
syslog(LOG_NOTICE,
"date changed by %s from %s",
msg->tsp_name, olddate);
OpenPOWER on IntegriCloud