#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/