# net-misc/ntpclient set the system clock once and exit?

## turtles

Greetings all I tried to use ntpclient today to adjust my laptops clock today for daylight savings time  :Smile: 

```
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

```
man ntpclient 
```

Gives nothing.

https://www.eecis.udel.edu/~mills/ntp/html/index.html

Gives too much  :Smile: 

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':

```
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:

```
ntpclient -dstvn pool.ntp.org
```

```
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!

----------

## Ant P.

DST is handled by your /etc/timezone setting, NTP just sets the internal UTC time.

----------

## NeddySeagoon

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.

----------

## turtles

Oh yeah Its been a while since I thought about it

So I have a

/etc/timezone of :  

```
America/Los_Angeles
```

and DST did not got set. Strange.

----------

## turtles

Greetings all

my main issue was ntpclient not working

```
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

```
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:

```
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 

```
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

----------

