Adjtime no longer working in 2.0?

Erik Corry (erik@arbat.com)
Wed, 16 Sep 1998 08:04:12 +0200


It seems to me that adjtime may no longer be working in 2.0.
Alternatively, since ntp users have not complained, perhaps
adjtime offsets greater than one second are no longer working.
I have 2.0.35pre2, and used to keep my system clock in line with
getdate, a utility by michael@actrix.gen.nz (Michael Hamilton)
(be careful, there seem to be several getdates out there, not
all of them use adjtime), and time has started drifting. I have
a dual PPro. As a test I repeatedly ran the following program:

#include <sys/time.h>
#include <stdio.h>
#include <errno.h>
#include <time.h>

main()
{
struct timeval adjustment, old_adjustment;
adjustment.tv_sec = 100;
adjustment.tv_usec = 400000;
if (adjtime(&adjustment, &old_adjustment) == -1) {
fprintf(stderr,
"getdate: error - adjust time error - %s\n", strerror(errno));
}
}

which gives no error, but appears to have no effect on the
system time. The getdate code is very simple, and on it's
face bugfree:

struct timeval adjustment, old_adjustment;
adjustment.tv_sec = new_time - old_time;
adjustment.tv_usec = 0;
if (adjtime(&adjustment, &old_adjustment) == -1) {
fprintf(stderr,
"getdate: error - adjust time error - %s\n", strerror(errno));
}
print_samples(host, first_sample, second_sample);
if (old_adjustment.tv_sec != 0 || adjustment.tv_usec != 0) {
printf("getdate: replaced existing adjustment of %d second(s), %d usec(s).\n",
old_adjustment.tv_sec,
adjustment.tv_usec);
}
printf("getdate: time will adjust slowly by %d second(s) to match %s.\n",
adjustment.tv_sec,
host);

which prints messages like:

# /usr/local/bin/getdate -adjust 5 1000 sunsite.auc.dk www.daimi.aau.dk
getdate: sunsite.auc.dk Wed Sep 16 08:09:13 1998, Wed Sep 16 08:09:13 1998
getdate: replaced existing adjustment of 548 second(s), 0 usec(s).
getdate: time will adjust slowly by 549 second(s) to match sunsite.auc.dk.

Yes nothing seems to happen.

I can mail the source of getdate-1.0.tar.gz to anyone
who is interested. It's 10673 bytes with an md5sum of
f957555ab469bc2c91f0b62e4947e3c1. It used to be on
Sunsite.

-- 
Erik Corry

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/