1833387 Members
3013 Online
110052 Solutions
New Discussion

Re: Ntp problem

 
SOLVED
Go to solution
mark_150
Occasional Contributor

Ntp problem

Hi all
I configured my system to use local ntp server using its internal clock.I installed patch phne_19710. My system contains one ntp server and three ntp clients. All hpux 10.20. I moved time on ntp server 2 minutes forward and after 10 minutes all clients
was synchronized to the server's time. But synchronization occurs immediately i.e. client's clock jumps 2 minutes in one second and this may cause application problem.
If this is correct?
Why ntp client doesn't correct its time slowly as in command ntpdate -B server?
9
5 REPLIES 5
John Bolene
Honored Contributor
Solution

Re: Ntp problem

Xntpd does it now with not much slew time.
Your NTP server should not vary much.

If you need to slew clock time, here is a C program that I use.

#include
#include
#include

int call_adjtime(delta, olddelta)
struct timeval *delta;
struct timeval *olddelta;
{
int retval;

retval = adjtime(delta, olddelta);
if(retval != 0) {
perror("adjtime");
}
return(retval);
}

main(argc, argv)
int argc;
char **argv;
{
char *prog;
struct timeval delta, olddelta;
int retval;

if((prog = (char *)rindex(*argv, '/')) == NULL) {
prog = *argv;
}
else {
prog++;
}

if(argc != 2) {
fprintf(stderr, "Usage: %s seconds\n", prog);
exit(1);
}

delta.tv_sec = atoi(argv[1]);
delta.tv_usec = 0;
olddelta.tv_sec = 0;
olddelta.tv_usec = 0;

retval = 1;
while(retval != 0) {
retval = call_adjtime(δ, &olddelta);
}
for(;;) {
delta.tv_sec = olddelta.tv_sec;
delta.tv_usec = olddelta.tv_usec;
call_adjtime(NULL, &olddelta);
if(olddelta.tv_sec == 0 && olddelta.tv_usec == 0) {
if(delta.tv_sec == 0 && labs(delta.tv_usec) < 100000) {
break;
}
else {
call_adjtime(δ, &olddelta);
call_adjtime(NULL, &olddelta);
}
}
printf("remained %d.%06d\n", olddelta.tv_sec, labs(olddelta.tv_usec));
sleep(1);
}
}
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com
T G Manikandan
Honored Contributor

Re: Ntp problem

mark_150
Occasional Contributor

Re: Ntp problem

Thanks for all.
9
Sean OB_1
Honored Contributor

Re: Ntp problem

my understanding is that the NTP client will sync with whatever the server says. Think of it this way. When daylight savings time comes around and you bump up your ntp server 1 hour, do you want the clients to make that same change immediately or spread it out slowly over the entire day?

If you need to adjust it slowly adjust the server slowly via the "date -a" command.

rick jones
Honored Contributor

Re: Ntp problem

whether a client slews time or does a stepwise adjustment depends on the settings and patches on the _client_ not the server, so you need to make sure that the client's have the slew patch installed and enabled.

there is no rest for the wicked yet the virtuous have no pillows