Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
NTP incorrect date and time
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
MattMurdock
n00b
n00b


Joined: 27 Dec 2011
Posts: 4

PostPosted: Sun Jan 15, 2012 2:37 am    Post subject: NTP incorrect date and time Reply with quote

I'm running KDE and have it configured to set the time and date automatically through NTP. Unfortunately the date and time are wrong by almost a day, and as of yet I haven't been able to diagnose the cause. Any help would be great.

Here's some info on my system and what I've tried so far:
Set timezone to Auckland/New Zealand during installation with
Code:
# cp /usr/share/zoneinfo/Pacific/Auckland /etc/localtime
# cat /etc/timezone
Pacific/Auckland


Contents of /etc/conf.d/hwclock (default):
Code:
clock="UTC"
clock_systohc="NO"
clock_hctosys="YES"
clock_args=""


/etc/ntp.conf is default, i.e. the ntp servers are
Code:
server 0.gentoo.pool.ntp.org

etc.

As of writing the time is 3:30 PM Sun 15th Jan 2012, this is what ntpdate returns:
Code:
# ntptime
ntp_gettime() returns code 5 (ERROR)
  time d2bd6b2f.b11ec000  Mon, Jan 16 2012  4:11:43.691, (.691875),
  maximum error 16000000 us, estimated error 16000000 us, TAI offset 0
ntp_adjtime() returns code 5 (ERROR)
  modes 0x0 (),
  offset 0.000 us, frequency 0.000 ppm, interval 1 s,
  maximum error 16000000 us, estimated error 16000000 us,
  status 0x40 (UNSYNC),
  time constant 2, precision 1.000 us, tolerance 500 ppm,


Messages from ntp daemon in /var/log/syslog:
Code:
...
Jan 16 04:12:16 matt-gentoo-desktop /etc/init.d/net.eth0[3726]: ERROR: net.eth0 failed to start
Jan 16 04:12:17 matt-gentoo-desktop ntpd[3818]: ntpd 4.2.6p3@1.2290-o Tue Dec 27 18:19:24 UTC 2011 (1)
Jan 16 04:12:17 matt-gentoo-desktop ntpd[3819]: proto: precision = 0.130 usec
Jan 16 04:12:17 matt-gentoo-desktop ntpd[3819]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Jan 16 04:12:17 matt-gentoo-desktop ntpd[3819]: Listen and drop on 1 v6wildcard :: UDP 123
Jan 16 04:12:17 matt-gentoo-desktop ntpd[3819]: Listen normally on 2 lo 127.0.0.1 UDP 123
Jan 16 04:12:17 matt-gentoo-desktop ntpd[3819]: Listen normally on 3 eth0 10.1.1.2 UDP 123
Jan 16 04:12:17 matt-gentoo-desktop ntpd[3819]: Listen normally on 4 eth0 xxxx::xxxx:xxx:xxxx:xxxx UDP 123
Jan 16 04:12:17 matt-gentoo-desktop ntpd[3819]: Listen normally on 5 lo ::1 UDP 123
Jan 16 04:12:17 matt-gentoo-desktop ntpd[3819]: peers refreshed
Jan 16 04:16:09 matt-gentoo-desktop dhcpcd[3367]: eth0: renewing lease of 10.1.1.2
Jan 16 04:16:09 matt-gentoo-desktop dhcpcd[3367]: eth0: acknowledged 10.1.1.2 from 10.1.1.1
Jan 16 04:16:09 matt-gentoo-desktop dhcpcd[3367]: eth0: leased 10.1.1.2 for 3600 seconds
...


Cheers
Back to top
View user's profile Send private message
salahx
Guru
Guru


Joined: 12 Mar 2005
Posts: 439

PostPosted: Sun Jan 15, 2012 2:43 am    Post subject: Reply with quote

It might not set the date and time if the clock is too far off (more than 1000 seconds), try using "ntpd -g -q"
Back to top
View user's profile Send private message
MattMurdock
n00b
n00b


Joined: 27 Dec 2011
Posts: 4

PostPosted: Sun Jan 15, 2012 3:08 am    Post subject: Reply with quote

Ok I tried "ntpd -g -q" after which ntptime is returning the correct date/time. However after a computer restart ntptime was returning Mon Jan 16th (incorrect) again.
So in /etc/conf.d/hwclock I changed:
Code:
clock_systohc="NO"
clock_hctosys="YES"

to
Code:
clock_systohc="YES"
clock_hctosys="NO"

and after a restart both ntptime and KDE are reporting the correct time. So far so good :)

However ntptime is still giving
Code:
ntp_gettime() returns code 5 (ERROR)

which apparently is a "clock not synchronised" error. It also states "estimated error 16000000 us". What's going on here?
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sun Jan 15, 2012 7:52 am    Post subject: Reply with quote

For debugging, see wiki entry.
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