LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-11-2011, 06:52 AM   #1
xerox
Member
 
Registered: Mar 2011
Posts: 43

Rep: Reputation: 0
Unhappy /etc/adjtime


I have a query regarding /etc/adjtime file.

We had an issue, where our system time was drifting.
We fixed this issue by changing Local to UTC in that file.

How will this change impact our system?
How does this fix the problem?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 10-11-2011, 08:00 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060
One caution about /etc/adjtime (from the manual page):
Quote:
The adjustment that adjtime() makes to the clock is carried out in such a manner
that the clock is always monotonically increasing. Using adjtime() to adjust the
time prevents the problems that can be caused for certain applications (e.g.,
make(1)) by abrupt positive or negative jumps in the system time.

adjtime() is intended to be used to make small adjustments to the system time.
Most systems impose a limit on the adjustment that can be specified in delta. In
the glibc implementation, delta must be less than or equal to (INT_MAX / 1000000 -
2) and greater than or equal to (INT_MIN / 1000000 + 2) (respectively 2145 and
-2145 seconds on i386).
Which leads to a couple of questions -- are you using NTP (and, oh, yeah, is it actually synchronizing with an external time service as shown by nptq -p); have you checked and perhaps replaced the battery (it's kind of like a battery wristwatch, no juice, no joy)?

If you are using NTP (and if not, why in the world not), what kind of value do you show in /etc/npt/drift? All four of my servers are somewhere in the range of 75.0-85.0; if you have a huge value there it's worth a look at the battery -- keep in mind that it's not a value you set, it's set by by the running NTP daemon.

The clocks in these things really aren't up to the standards of a $20 wristwatch and need to be kept in sync by some external time source (be that NTP, a GPS clock, a radio clock) and, of those, NPT is surely the least costly. Might be worth a look-see if you're not using it now.

Hope this helps some.
 
Old 10-11-2011, 10:15 AM   #3
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292
I've found that using hpet as the clock source 'clocksource=hpet' on the kernel boot parameters helps a lot with the drift.
 
Old 10-11-2011, 11:39 PM   #4
xerox
Member
 
Registered: Mar 2011
Posts: 43

Original Poster
Rep: Reputation: 0
Question

I actually want to know, what the parameter UTC means in that file.

How is local time calculated?
Why is there no drift or comparatively less when set to UTC...

And whether changing the 3rd parameter in that from Local to UTC will impact any other processes?
 
Old 10-12-2011, 09:53 AM   #5
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060
The UTC parameter in /etc/adjtime means that the hardware clock is set to Universal Coordinated Time (UTC is the French abbreviation). If that parameter is LOCAL, that means that the hardware clock is set to local time.

Local time is the offset from UTC; e.g., if your machine lives in the eastern time zone in the US, the difference is 5 hours when daylight savings time is not in effect or 4 hours when DST is. If you live in the UK, the difference is 0 hours when DST (or "Summer Time" in the UK) is not in effect or 1 hour when it is. In both cases, that's local time: UTC does not do daylight savings time, no such thing. UTC is physical, DST is political.

There should be no difference in drift irrespective of what time zone you have set; the time zone has nothing whatsoever to do with drift.

You may be aware that you have two clocks in your system -- the real time clock that runs all the time (it's the "hardware" clock powered by the CMOS battery) and the system clock that runs only when the computer is on. The system clock typically has better precision (generally about 1 microsecond) but the RTC has better long-term stability. You can see the difference between the two with the following (this is my system, yours will vary):
Code:
prompt: adjtimex --compare=4
                                      --- current ---   -- suggested --
cmos time     system-cmos  error_ppm   tick      freq    tick      freq
1318421918      -0.000235
1318421928       0.006276      651.1  10000   6569995
1318421938       0.017094     1081.8  10000   6569995    9990   1209120
1318421948       0.007895     -919.9  10000   6569995   10010   1321495
See the manual page for adjtimex for what all that means.

The running processes on your system are at system time (local time); i.e., not affected by the RTC. This was determined during system setup -- at some point you were asked about the RTC and your local timezone. On my systems, there is a utility for setting these, /usr/sbin/timeconfig, yours may vary (and you must be logged in as root to do this).

And, finally, the best way to keep your system(s) at the correct time is to use NTP; essentially, NTP slews the clocks roughly every 11 minutes to a reference time. The reference time is provided by external time servers (you should use three) that are referenced to so-called atomic clocks which are, here we go, the coordinated universal time.

NTP will, for all practical purposes, eliminate drift and is worth your time to set up. If, for some reason, you cannot use NTP, you can use adjtimex to correct for drift -- read the manual page for adjtimex carefully if you're going to do this.

Hope this helps some.
 
2 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
/etc/adjtime sulekha Ubuntu 1 09-03-2008 01:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:13 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration