Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I copied /usr/share/zoneinfo/Asia/Kolkata to /etc/localtime. I also tried editing ZONE in /etc/sysconfig/clock but my default timezone is still CEST and not IST.

I already checked to make sure that a TZ variable isn't overriding it.

I've already googled it and found http://www.redhat.com/advice/tips/timezone.html and http://kezhong.wordpress.com/2010/03/08/change-timezone-on-centos-5-4/ but it didn't help.

I'm out of ideas. What am I doing wrong?

[root@dhroid ~]$ cat /etc/sysconfig/clock 
ZONE="Asia/Kolkata"
UTC=false
ARC=false
[root@dhroid ~]$ ls -al /etc/localtime 
lrwxrwxrwx 1 root root 32 Jul 19 16:10 /etc/localtime -> /usr/share/zoneinfo/Asia/Kolkata
[root@dhroid ~]$ env | grep TZ
[root@dhroid ~]$ date
Tue Jul 19 16:11:52 CEST 2011
[root@dhroid ~]$ 
share|improve this question
    
what about the daemons such as crond or syslog? when i change /etc/localtime or /etc/sysconfig/clock, the date and time showed in console changes really, but the logs for crontabs and messages mantains the past timestamp... it is necessary a reboot ... –  Mario Apr 23 at 6:21

3 Answers 3

I have fixed the problem. There was nothing wrong with what I did. Everything was right the whole time. The issue was with the tzdata package, which was corrupted. As soon as I reinstalled the package from yum with yum reinstall tzdata, it worked!

share|improve this answer
    
All that you had to do is just run tzdata-update utility. This copies the correct zonefile to /etc/localtime. –  Borys Jul 4 '13 at 15:15

after saving the changes to the file: '/etc/sysconfig/clock' a reboot is required for the changes in the timezone to take affect. Did you reboot your box after that ?

share|improve this answer
    
No, I haven't rebooted. But what about the /etc/localtime. When I worked with other systems (Fedora and Debian), I only needed to change /etc/localtime. I didn't need to do anything else. –  dhroid Jul 19 '11 at 14:20
    
# ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime Exit from all sessions you are currently logged in and try rebooting your box. #date command will then show a updated time zone. –  Ashutosh Narayan Jul 19 '11 at 14:23
    
I'm not rebooting the system. There has to be a better solution. Other distros don't require a reboot for timezone changes. –  dhroid Jul 19 '11 at 14:29
    
Which distro are you using ? If it is a RedHat / Fedora / CentOS, then I am confident that a reboot is required for the changes to take place because there is something called hardware clock which should also sync with system timings and that will happen only after a reboot. That's what I suggest. –  Ashutosh Narayan Jul 19 '11 at 14:34
    
It is CentOS. Well my Fedora server didn't require a reboot and the change was applied immediately. The only difference is the CentOS is a VMware system and Fedora one is OpenVZ. –  dhroid Jul 19 '11 at 14:39

i'm not 100% certain, but i believe that if you have /etc/sysconfig/clock configured with

UTC=false

then you aren't going to be able to dynamically change the timezone.

all of my machines are set with UTC true, and the local timezone as america/los_angeles. if i relink /etc/localtime to a different timezone, it's reflected in the 'date' command immediately.

if your system clock isn't locked to UTC, then the system doesn't know how to interpret a changed timezone, since they're all relative to UTC. only a reboot will reset its brain.

edit: so i think the bottom line is that until you've configured /etc/sysconfig/clock to UTC=true and rebooted (and reset your bios clock to utc) then you're stuck with that reboot.

share|improve this answer
    
I have asked my host company's technical support to –  dhroid Jul 20 '11 at 5:55
    
Turns out even support weren't able to find out what the problem is. I've tried with both settings, UTC set to true and false, and neither makes a difference. Support has suggested I reinstall the OS. I'm gonna do that as a last resort but I really want to find out why this is happening in the first place. I've not heard of anyone with this issue before. –  dhroid Jul 20 '11 at 12:50

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.