LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-21-2016, 08:14 PM   #1
themrrobert
Member
 
Registered: Feb 2007
Distribution: Debian Sid
Posts: 52

Rep: Reputation: 16
NTP Sets time wrong every time (26 seconds)


Hello,

This has been driving me crazy.

We installed a new server (CentOS 7), and have NTP running and syncing to another machine in the network.

It works, it syncs the time, but incorrectly.

It's always 26 seconds behind.

I can set the time ahead 26 seconds, then it's correct.

However ntpdate {ntpserver} will change the clock back to 26 seconds behind.

$ ssh {ntpserver} date && date shows:

Sun Feb 21 18:12:36
Sun Feb 21 18:12:10

I've tried everything. Looked at dozens of threads.

Please help

/Edit:
Here is output from hwclock --debug && timedatectl status (note the RTC clock is correct because I set it manually 26 seconds ahead, then I synced with ntpdate {ntpserver} and ran these commands
Code:
# hwclock --debug && timedatectl status && date
hwclock from util-linux 2.23.2
Using /dev interface to clock.
Last drift adjustment done at 1456107784 seconds after 1969
Last calibration done at 1456107784 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2016/02/22 02:23:42
Hw clock time : 2016/02/22 02:23:42 = 1456107822 seconds since 1969
Sun Feb 21 18:23:16 2016  -0.235122 seconds
      Local time: Sun 2016-02-21 18:23:16 PST
  Universal time: Mon 2016-02-22 02:23:16 UTC
        RTC time: Mon 2016-02-22 02:23:42
       Time zone: right/America/Los_Angeles (PST, -0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  Sun 2015-11-01 01:59:59 PDT
                  Sun 2015-11-01 01:00:00 PST
 Next DST change: DST begins (the clock jumps one hour forward) at
                  Sun 2016-03-13 01:59:59 PST
                  Sun 2016-03-13 03:00:00 PDT
Sun Feb 21 18:23:16 PST 2016
Update:

It seems this computer has the correct time, but is counting from Epoch wrong.

Note this output:
Code:
# date +"%s" && ssh {timeserver} date +"%s"
1456108363
1456108363

# date && ssh {timeserver} date
Sun Feb 21 18:32:29 PST 2016
Sun Feb 21 18:32:55 PST 2016

Last edited by themrrobert; 02-21-2016 at 08:34 PM.
 
Old 02-21-2016, 09:04 PM   #2
themrrobert
Member
 
Registered: Feb 2007
Distribution: Debian Sid
Posts: 52

Original Poster
Rep: Reputation: 16
Solved. It was a leap second issue.

After realizing the clocks had the same second count, I looked up the number of leap seconds, and it is 26 since epoch. Perfect.

Turns out the timezone data was inaccurate.

Installing/updating tzdata had no effect.

I was using right/America/Los_Angeles but now use America/Los_Angeles

I also copied the file from a working server for good measure. And linked to the new file, and yay it worked!
 
Old 02-21-2016, 09:07 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,703

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
Is this a physical or virtual machine?

The RTC aka hardware clock's sole purpose is to provide a time reference for the system clock when the computer boots. It runs independently of the operating system.

The system at the moment is not synchronized to ntp. Post the output of the ntpq -p command. When the value of reach is 377 the client should be synced to the server if all goes well and you should see an * before the ntp server name.

Nevermind, well done.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NTP: time correction of 1879 seconds exceeds sanity limit (1000); set clock manually LittleMaster Linux - Newbie 1 07-15-2013 05:02 AM
[SOLVED] System sets wrong values for time at boot and to hwclock during shutdown. JZL240I-U Linux - Kernel 14 11-18-2010 08:06 AM
ntpdate sets the wrong time [fixed] xnomad Linux - Software 5 01-22-2010 03:09 PM
ntpd sets time wrong jimjones Linux - Software 1 02-19-2009 08:45 PM
ntp time is wrong wyndetygre Linux - Software 18 05-02-2008 06:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration