[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: time zone and UTC issue



J. B wrote:
> And also set the H/W clock to UTC with "hwclock --utc --systohc"
> 
> still my H/W clock shows local timezone !!!

What commands are you using to determine that this is the case?  If
you have done the suggestions above then your clock should be in UTC.

> How can I keep the H/W to UTC then and how can I apply different
> timezone to different login user ? say someone use german and
> another different login user use uk timezone. dpkg-reconfigure sure
> change the H/W timezone to UTC, but also changes local.

Set the TZ environment variable to the proper timezone for the user.
Every user may have a unique timezone by setting a unique TZ variable
in their environment.

You can set it to be a named timezone like this:

  $ TZ=America/Denver date -R
  Mon, 03 Dec 2012 01:55:59 -0700

  $ TZ=Asia/Kolkata date -R
  Mon, 03 Dec 2012 14:40:10 +0530

To set the TZ variable put the following in the user ~/.bashrc or
equivalent file.  Use whatever is proper for your desired timezone.

  export TZ=Europe/Berlin

See the GNU libc documentation for details:

  http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html

In combination with GNU date this can even be used to convert times
from one timezone to another.  This example converts from Paris time
to New York time.

  $ TZ="America/New_York" date -R --date='TZ="Europe/Paris" 2004-10-31 06:30'
  Sun, 31 Oct 2004 01:30:00 -0400

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: