10

Here in the UK we are UTC+1. I set the time using 'date'. However it keeps resetting back to standard UTC, I'm guessing via a NTP time server.

I've tried setting the timezone with tzselect but it does not change the time, it remains at UTC instead of local time.

Therefore TZ='Europe/London' will be used.
Local time is now:  Thu Jun 25 10:57:48 BST 2009.
Universal Time is now:  Thu Jun 25 09:57:48 UTC 2009.

The above output is correct but the time does not actually get changed.

I either need to disable auto updating of time or ideally setting the timezone correctly.

Kris
  • 271
  • 2
  • 3
  • 11
  • I have tried setting UTC=no in /etc/default/rcS. This has had no effect (do I need to reboot something)? – Kris Jun 25 '09 at 10:06
  • UTC=no only governs how the RTC on your mobo should be interpreted, the OS maintains time separately and mostly just utilises the RTC to preserve time between reboot/poweroff. – Kjetil Joergensen Jun 25 '09 at 11:13

7 Answers7

27

You can also do :

dpkg-reconfigure tzdata

It will then allow you to choose your timezone.

Antoine Benkemoun
  • 7,314
  • 3
  • 42
  • 60
2
  1. apt-get install ntpdate
  2. ntpdate pool.ntp.org

This will work. i have done this on my server, have a try.

cyclotron:~# ntpdate pool.ntp.org 25 Jun 15:45:05 ntpdate[18445]: step time server 120.88.47.10 offset 485.998764 sec

Caterpillar
  • 1,132
  • 2
  • 23
  • 47
1

I'm not 100% on this, but it's an idea.

I know that on RHEL/CentOS, the time zone is set under /etc as a symlink.

For example, mine is

localtime -> /usr/share/zoneinfo/America/Los_Angeles

Can you confirm that your link is Europe/London? If not, try deleting the localtime symlink and creating one.

1

Possibly not an issue in this instance, but I have seen problems when using named timezones before. I'd suggest trying with the GMT offset instead. (Which in your case is obviously just GMT)

  • 2
    Sorry, I don't have an answer to the original question (sounds like you are doing the right thing to me), but unfortunately, in general, this suggestion won't work as you expect, because selecting a specific offset won't adjust for daylight savings time accordingly. I use Europe/London (along with NTP) and get GMT or BST at the correct times of year (many folks don't realise the UK is on GMT only during winter-time). – Andrew Ferrier Jun 26 '09 at 12:35
1

In Kubuntu, you set the timezone during installation, and then you can change the timezone using System Settings -> Date & Time and then selecting a time zone. However, each upgrade of tzdata (from apt-get upgrade or from automatic package upgrade) seems to reset the timezone back to whatever you picked at installation. I just changed it with dpkg-reconfigure tzdata, as suggested, and this seemed to work. Perhaps it will survive the next tzdata upgrade.

0

Normally you need to

  • set the timezone using tzselect
  • then set the time using date

Afterwards, things should be correct.

So what happens if you do these two things? Could you post the output of "date"?

If time is changed correctly, but changes back later, something is interfering.

Common culprits:

  • NTP server (check for running ntpd or similar)
  • ntpdate from cronjob
  • hwclock being confused about your timezone (should only affect reboots)

If date does not change anything, something's really wrong...

sleske
  • 10,009
  • 4
  • 34
  • 44
  • Originally I set tzselect and date. But it got reset (without a reboot). I didn't see NTP installed or a cronjob, so I'm not quite sure what was causing the problem. – Kris Jun 27 '09 at 17:22
0

I just had this problem too:

I used this to turn off UTC

The Unofficial Ubuntu Starter Guide | linuxtopia.org

then used the ntp service and am using the default ubuntu time server.

Also made sure my lat/long regional settings were good.

Cheers

Dave Mateer
  • 171
  • 1
  • 1
  • 9