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.

I'm trying to get programs to log in local time for my own sanity.

I have updated my timezone with:

 dpkg-reconfigure tzdata

But the result of that command is:

Current default time zone: 'Australia/Adelaide'
Local time is now:      Mon May 20 03:09:52 UTC 2013.
Universal Time is now:  Mon May 20 03:09:52 UTC 2013.

Notice the UTC in Local time

Any reason why this may be?

I have done a lot of Googling but my problem seems different to all of them :(

Here are some more details:

# cat /etc/timezone
Australia/Adelaide

# date
Mon May 20 03:41:06 UTC 2013

# export TZ='Australia/Adelaide'; date
Mon May 20 13:16:11 CST 2013

Setting export TZ='Australia/Adelaide'; in my /etc/profile makes date work by default in a bash session but does not change the system log date (after restarting the service)

Edit:

# ls -l /etc/localtime
lrwxrwxrwx 1 root root 20 May 10 14:48 /etc/localtime -> /usr/share/zoneinfo/

# ls /etc/localtime/
Adelaide    Chile    GMT        Japan      PST8PDT    Universal
Africa      Cuba     GMT+0      Kwajalein  Pacific    W-SU
America     EET      GMT-0      Libya      Poland     WET
Antarctica  EST      GMT0       MET        Portugal   Zulu
Arctic      EST5EDT  Greenwich  MST        ROC        iso3166.tab
Asia        Egypt    HST        MST7MDT    ROK        localtime
Atlantic    Eire     Hongkong   Mexico     Singapore  localtime.dpkg-new
Australia   Etc      Iceland    Mideast    SystemV    posix
Brazil      Europe   Indian     NZ         Turkey     posixrules
CET         Factory  Iran       NZ-CHAT    UCT        right
CST6CDT     GB       Israel     Navajo     US         zone.tab
Canada      GB-Eire  Jamaica    PRC        UTC

Answer:

Worked it out thanks to jamzed. for some reason I had /etc/localtime as a symlink... the IT Guy here set up the server using Turnkey 12 so maybe that was the problem.

# mv /etc/localtime /etc/localtime.old
# cp /usr/share/zoneinfo/Australia/Adelaide /etc/localtime
# date
Thu May 23 09:36:17 CST 2013
share|improve this question

migrated from serverfault.com May 22 '13 at 14:46

This question came from our site for professional system and network administrators.

3 Answers 3

up vote 9 down vote accepted

Try this way:

$ sudo cp /usr/share/zoneinfo/Australia/Adelaide /etc/localtime
share|improve this answer
    
cp /usr/share/zoneinfo/Australia/Adelaide /etc/localtime dit not change anything for me :( local time is still UTC, I have added what ls -l /etc/localtime says also. –  complistic May 22 '13 at 4:25
2  
Why did you create symlink there? You need to copy a one file... Fix it by removing symlink "rm /etc/localtime" and do cp as I wrote "cp /usr/share/zoneinfo/Australia/Adelaide /etc/localtime" ;-) –  jamzed May 22 '13 at 5:08
    
symlink was there by default.. maybe a turnkey thing or something. mv /etc/localtime /etc/localtime.old cp /usr/share/zoneinfo/Australia/Adelaide /etc/localtime fixed the problem :) Thank you! –  complistic May 23 '13 at 0:04

I think the best way to achieve this, is by executing:

sudo dpkg-reconfigure tzdata
share|improve this answer
    
+1, this is definitely the right way to do it on debian systems. –  jhauris Jun 5 at 13:29
    
Yep, dpkg-reconfigure tzdata was the first thing I tried. It didn’t work for me because /etc/localtime was a symlink for some reason. After fixing that both ways would change the timezone correctly. –  complistic Oct 27 at 22:31

Set the time automatically using "Network Time Protocol". Use the following command to install ntp on debian.

$ sudo apt-get install ntp

For detailed information please read the documentation https://wiki.debian.org/DateTime

share|improve this answer
    
It is better to provide the steps here, and use the link as a reference for further details. That way your answer does not lose all of it value when the link becomes invalid. –  Anthon Apr 12 at 19:36

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.