Mailing List Archive

setting system time
Try to set system clock via script:

/usr/sbin/htpdate 1.ro.pool.ntp.org
/sbin/hwclock -w

But when I run it always prints:
Offset 38.000 seconds

The system clock does not adjust.
Re: setting system time [ In reply to ]
On 4/8/2021 6:07 PM, thelma@sys-concept.com wrote:
> Try to set system clock via script:
>
> /usr/sbin/htpdate 1.ro.pool.ntp.org
> /sbin/hwclock -w
>
> But when I run it always prints:
> Offset 38.000 seconds
>
> The system clock does not adjust.


The hardware clock syncs to the software clock. If, when you run the
date command, it prints the correct time (accounting for timezones) then
as far as I know, that is the time your hardware clock uses. Besides, 38
seconds is not bad. Unless you are doing something between computers
that requires EXTREMELY precise time, then I wouldn't bother. If you do
want to fix things, ntpdate is kind of old (I assume that's what you
meant, as I've never heard of htpdate). You can accomplish the same
thing with the ntp command. Just use: ntpd -g -q. That will set the
clock once according to the pool server, then quit. And it sets the
clock, no matter how far off it is.
Re: setting system time [ In reply to ]
On 4/8/21 6:24 PM, Dan Egli wrote:
> On 4/8/2021 6:07 PM, thelma@sys-concept.com wrote:
>> Try to set system clock via script:
>>
>> /usr/sbin/htpdate 1.ro.pool.ntp.org
>> /sbin/hwclock -w
>>
>> But when I run it always prints:
>> Offset 38.000 seconds
>>
>> The system clock does not adjust.
>
>
> The hardware clock syncs to the software clock. If, when you run the date command, it prints the correct time (accounting for timezones) then as far as I know, that is the time your hardware clock uses. Besides, 38 seconds is not bad. Unless you are doing something between computers that requires EXTREMELY precise time, then I wouldn't bother. If you do want to fix things, ntpdate is kind of old (I assume that's what you meant, as I've never heard of htpdate). You can accomplish the same thing with the ntp command. Just use: ntpd -g -q. That will set the clock once according to the pool server, then quit. And it sets the clock, no matter how far off it is.

Yes, the "ntpd -g -q" work better; the time is adjusted correctly.

with /htpdate 1.ro.pool.ntp.org I always got the same Offset number, doesn't matter how many time I run it.