WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Changed /etc/localtime does not work after default tz= boot.  (Read 7778 times)

Offline kagashe

  • Full Member
  • ***
  • Posts: 129
    • My Tryst with Linux
Changed /etc/localtime does not work after default tz= boot.
« on: January 10, 2009, 04:57:39 AM »
If you boot TC without any tz= option it takes tz=UTC (perhaps it is default).

After booting if you remove /etc/localtime and replace it with any zone the time zone does not change.

If you boot with any other tz= option and replace /etc/localtime file the timezone changes are honored.

kagashe

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Changed /etc/localtime does not work after default tz= boot.
« Reply #1 on: January 10, 2009, 12:05:03 PM »
True the default is UTC when not specified as a boot option.

However, when you manually change /etc/localtime don't also forget to change the TZ export.

If you open a root shell window and then
1.  cp a new timezone file to /etc/localtime
2. export TZ=Your/New/Timezone
3. getTime.sh

You should see both UTC and your timezone info displayed.

However, you should always try to use the TZ boot option so that the time is set early in the boot process and is verified.

EDIT:

You can also make the /etc/locatime work by "unset TZ"
I was trying to verify a boot time selected timezones, but I may perhaps be better off not to do so.
By doing so, I seem to have two timezone systems with TZ taking precedence. Allowing only offsets as a TZ variable may be a more flexible solution be it un-verified and perhaps a bit more cryptic.  I will make so more tests and report back.

« Last Edit: January 10, 2009, 12:54:23 PM by roberts »
10+ Years Contributing to Linux Open Source Projects.

Offline kagashe

  • Full Member
  • ***
  • Posts: 129
    • My Tryst with Linux
Re: Changed /etc/localtime does not work after default tz= boot.
« Reply #2 on: January 10, 2009, 11:18:33 PM »
If you open a root shell window and then
1.  cp a new timezone file to /etc/localtime
2. export TZ=Your/New/Timezone
3. getTime.sh

You can also make the /etc/locatime work by "unset TZ"
Steps 1 to 3 as well as "unset TZ" works and the "getTime.sh" displays UTC on first line and localtime on second line, however, the JWM clock remains at UTC. If I restart JWM from menu option it remains at UTC after restart. If I exit to prompt and do "startx" it remains at UTC and "getTime.sh" once again displays UTC on both lines.

Quote
However, you should always try to use the TZ boot option so that the time is set early in the boot process and is verified.
That is true. I am booting with TZ=Asia/Kolkata and Kolkata.tce gets loaded before JWM and it displays my time correctly.

kagashe