[ntp:questions] Re: adjtime limited to 2145 seconds?

David L. Mills mills at udel.edu
Thu Jan 5 04:30:12 UTC 2006


Santashil,

You should consider that, at a slew rate of 500 PPM, an adjustment of 
2145 seconds would take 1.36 years to complete.

Dave

Santashil PalChaudhuri wrote:

> Hi,
> 
> Below I give a code snippet, for using adjtime() on my redhat system.
> The maximum delta allowed is +/- 2145 seconds. If I give bigger than
> this, then I get a EINVAL error no 22 as the delta is greater than the
> maximum allowed. Is this normal?
> 
> I was trying to use "ntpdate -B <server>" which uses the adjtime always
> and that gives a "Can't adjust the time of day: Invalid argument"
> because of this adjtime error.
> 
> Any comments will be appreciated.
> 
> Regards
> Santa
> 
> run the following as root....
> -------------------------
> #include <sys/time.h>
> #include <stdio.h>
> #include <errno.h>
> 
> int main(int argc, char *argv[])
> {
>     struct timeval adj, old;
>     int rc;
> 
>     adj.tv_sec=1;
>     adj.tv_usec=500000;
> 
>     rc=adjtime(&adj, &old);
>     if(rc==0) {
>         printf("adjtime() successful. "
>                "Olddelta = %u.%06u\n",
>                 old.tv_sec, old.tv_usec);
>     }
>     else {
>         printf("adjtime() failed, errno = %d\n",errno);
>         return -1;
>     }
> 
>     return 0;
> 




More information about the questions mailing list