Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
net-misc/ntpclient set the system clock once and exit?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1331

PostPosted: Sun Mar 11, 2018 8:51 pm    Post subject: net-misc/ntpclient set the system clock once and exit? Reply with quote

Greetings all I tried to use ntpclient today to adjust my laptops clock today for daylight savings time :)
Code:
ntpclient -s -h pool.ntp.org

No success.
Is there documentation available for net-misc/ntpclient ?
It seems the Gentoo version is actually a fork of the doolittle one:
http://doolittle.icarus.com/ntpclient/HOWTO
Code:
man ntpclient

Gives nothing.
https://www.eecis.udel.edu/~mills/ntp/html/index.html
Gives too much :)

The webiste listed on the ebuild is not helpfull it is just a github account and has no docs.
https://github.com/troglobit/ntpclient
The Gentoo WIKI refers to a different ntp-client

I noticed my first problem is the -h option has different behavior than the doolottle one,
It displays the following help text instead of meaning 'host':
Code:
Usage: ntpclient [-dlnstv] [-c count] [-f frequency] [-g goodness]
                 [-i interval] [-p port] [-q min_delay] [-L] SERVER
Options:
 -c count      Stop after count time measurements. Default: 0 (forever)
 -d            Debug, or diagnostics mode  Possible to enable more at compile
 -f frequency  Initialize frequency offset.  Linux only, requires root
 -g goodness   Stop after getting a result more accurate than goodness msec,
               microseconds. Default: 0 (forever)
 -h            Show summary of command line options and exit
 -i interval   Check time every interval seconds.  Default: 600
 -l            Attempt to lock local clock to server using adjtimex(2)
 -L            Use syslog instead of stdout for log messages, enabled
               by default when started as root
 -n            Don't fork.  Prevents ntpclient from daemonizing by default
               Only when running as root, does nothing for regular users
               Use -L with this to use syslog as well, for Finit + systemd
 -p port       NTP client UDP port.  Default: 0 ("any available")
 -q min_delay  Minimum packet delay for transaction (default 800 microseconds)
 -s            Simple clock set, implies -c 1 unless -l is also set
 -t            Trust network and server, no RFC-4330 recommended validation
 -v            Be verbose.  This option will cause time sync events, hostname
               lookup errors and program version to be displayed
 -V            Display version and copyright information

Arguments:
    SERVER     NTP server, mandatory, against which to sync system time

Bug report address: https://github.com/troglobit/ntpclient/issues
Project homepage: https://github.com/troglobit/ntpclient


So I see I need to run it with the -n Flag to get errors printed to stdout
I have tried a few combinations of stuff:
Code:
ntpclient -dstvn pool.ntp.org

Code:
ntpclient -dstvn http://pool.ntp.org

Gives me:
Quote:
ERROR - Failed creating UDP socket() to SNTP server: Address family not supported by protocol

(And yes I know about https://chrony.tuxfamily.org)
I am really curious if net-misc/ntpclient will set the system clock once and exit?
Thanks in advance!
_________________
Donate to Gentoo
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5161

PostPosted: Sun Mar 11, 2018 10:28 pm    Post subject: Reply with quote

DST is handled by your /etc/timezone setting, NTP just sets the internal UTC time.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 41290
Location: 56N 3W

PostPosted: Sun Mar 11, 2018 10:42 pm    Post subject: Reply with quote

turtles,

turtles wrote:
I am really curious if net-misc/ntpclient will set the system clock once and exit?

That's all it does.

Like Ant P. says, your internal clock should be UTC and all offsets from UTC are controlled by your timezone.

Its more complex if you dual boot with Windows. You need to let Windows deal with daylight saving time.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1331

PostPosted: Mon Mar 12, 2018 3:57 am    Post subject: Reply with quote

Oh yeah Its been a while since I thought about it
So I have a
/etc/timezone of :
Code:
America/Los_Angeles

and DST did not got set. Strange.
_________________
Donate to Gentoo
Back to top
View user's profile Send private message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1331

PostPosted: Mon Mar 12, 2018 5:13 pm    Post subject: Reply with quote

Greetings all
my main issue was ntpclient not working
Code:
ntpclient -dstvn pool.ntp.org

would give me:
Quote:
ERROR - Failed creating UDP socket() to SNTP server: Address family not supported by protocol

I traced the problem down to booting with
Code:
ipv6.disable=1

My guess is net-misc/ntpclient should use IPV4 if IPV6 is present and disabled.
When I temporarily removed ipv6.disable=1 from my grub command line and rebooted net-misc/ntpclient was able to set the time and exit without any command line options:
Code:
ntpclient pool.ntp.org



As for the side issue of DST not getting set upon further investigation I had set /etc/conf.d/hwclock
to
Code:
clock="local"

This apparently disables sys-apps/openrc-0.34.11 from handling DST.
I have since set it to clock="UTC" and (hopefully) configured windows to use UTC also.
Perhaps this is also a bug in sys-apps/openrc?
Cheers
Turtles
_________________
Donate to Gentoo
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum