Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

My CentOS server is not updating showing correct time. I have set

$ ln -sf /usr/share/zoneinfo/Europe/London  /etc/localtime

Still I am on GMT.

I do see the following entries in /etc/sysconfig/clock:

$cat /etc/sysconfig/clock
ZONE="Europe/London"
UTC=true
ARC=false

Still it is not showing correct time.

NTP is running on this server:

$ ntpq -p
remote           refid      st t when poll reach   delay   offset  jitter
+         IP Address      3 u   42 1024  377    0.476   63.077   0.001
*         IP Address      3 u   53 1024  377    1.183   30.425   0.001

The ntp servers have the correct time. These are Windows Domain Controllers.

I have checked out the answer from here http://serverfault.com/questions/267629/configure-centos-with-ntp but that hasn't helped on this case.

Any ideas?

share|improve this question
1  
When you say "Still I am on GMT", what does that mean? You haven't shown an example of the problem. I suspect you have some processes with the old TZ variable left in their environment, but you haven't said which process is misbehaving so I can't say how you should fix it. –  Wumpus Q. Wumbley Jun 28 '13 at 8:50
    
What I mean by "Still I am on GMT", is the server is one hour behind. I need to set the server on BST. BST is 1 hour ahead of Coordinated Universal Time (UTC) –  mezi Jun 28 '13 at 9:03
    
What is your evidence? What command are you running to determine that "the server is one hour behind"? –  Wumpus Q. Wumbley Jun 28 '13 at 9:04
    
The date command shows this output. Fri Jun 28 09:16:28 GMT 2013 –  mezi Jun 28 '13 at 9:16
    
Now we're getting somewhere. Do you have a TZ variable? echo TZ=$TZ ; date –  Wumpus Q. Wumbley Jun 28 '13 at 9:20
show 7 more comments

1 Answer

up vote 5 down vote accepted

Separate out the problem: is it a Timezone misconfiguration, or a time configuration? You can use a couple of tools, date and zdump to determine this.

If date reports the correct UTC time, then you know the problem exists in the timezone setting, rather than in the internal time setting.

$ date --utc
Fri Jun 28 14:02:43 UTC 2013
$ date
Fri Jun 28 10:02:45 EDT 2013

zdump will print the current time (pulled from the internal UTC time) in the zone for each timezone specified

$ zdump /usr/share/zoneinfo/Europe/London /usr/share/zoneinfo/GMT
/usr/share/zoneinfo/Europe/London  Tue Jun 28 15:02:49 2013 BST
/usr/share/zoneinfo/GMT            Tue Jun 28 14:02:49 2013 GMT

If the Europe/London zoneinfo file produces the same time as the GMT zoneinfo file, then either the contents of Europe/London or GMT are incorrect. I'd be surprised if this is the case, but if so, look to either reinstall the file from rpm, or otherwise correct it. I believe there are programs available to read and output the zoneinfo contents, but don't know them as I just wrote my own that does it.

If you reach the case that the internal UTC time is correct, and the zoneinfo file is correct, but date still reports GMT, then the setting for localtime is incorrect or stale. man tzset will tell you more than you want to know on how the local time conversion happens, but do an env and look at the settings for environment variables TZ, TZDIR. Finally compare the localtime config file with the desired setting: with cmp /etc/localtime /usr/share/zoneinfo/Europe/London

share|improve this answer
    
zdump /usr/share/zoneinfo/Europe/London /usr/share/zoneinfo/GMT showed both Europe/London and GMT were showing same data which was wrong. I reinstalled tzdata rpm package and that has corrected it. Many thanks @Richard Perrin –  mezi Jun 28 '13 at 16:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.