[ntp:questions] Re: Problems with the Timezone

Martin Burnicki martin.burnicki at meinberg.de
Wed May 10 20:02:27 UTC 2006


Marvin Garcia wrote:
> This is what i have en the ntp.conf file.
Looks OK.

> Look this again
> root at snbntp0201 # date
> Wed May 10 21:41:57 GMT 2006
> root at snbntp0201 # date -u
> Wed May 10 17:42:00 GMT 2006
> root at snbntp0201 # echo $TZ
> GMT-4
> if you see my timezone var is set to GMT-4 (this is the one that
> belongs to me location).  the system date (Wed May 10 21:41:57 GMT
> 2006) should be (Wed May 10 17:42:00 GMT 2006) - 4 = Wed May 10
> 13:42:00 GMT 2006 not (Wed May 10 17:42:00 GMT 2006 )+ 4 = Wed May 10
> 21:41:57 GMT 2006, because my GMT is set to GMT-4.

As already mentioned in my other post, the old TZ thing works exactly the
other way round. If your local time is GMT - 4 hours (or let's better call
it UTC - 4 hours) then you must set the TZ environment variable to GMT4
because the definition is UTC = local time + TZ value. Just try:

date -u       # returns UTC time
TZ=GMT4 date  # displays UTC time - 4 hours

On my system is looks like this:

# date -u
Wed May 10 19:57:38 UTC 2006
# TZ=GMT4 date
Wed May 10 15:57:40 GMT 2006

I think the result is what you expect. However, "GMT" is a poor choice for
the abbreviation of the time zone name since it implies that the displayed
time is GMT, which in fact it isn't. Better use a abbreviation which is
associated to what you call your local time zone.

Anyway, using TZ this way is outdated and you should preferably configure
your time zone maybe as "America/Santo_Domingo", as Richard B. Gilbert
proposed in one of his posts.

Martin Burnicki

Meinberg Funkuhren
Bad Pyrmont

More information about the questions mailing list