timezone command

Greg 'groggy' Lehey grog at FreeBSD.org
Thu Apr 15 20:58:08 PDT 2004


On Thursday, 15 April 2004 at 22:15:06 -0400, JJB wrote:
> Time zone has been set during sysinstall.
> Is there an console command to display my configured time zone like
> format +05:00?

Not quite like that (are you in Pakistan?).  The problem is that time
zones aren't that simple: they contain information about daylight
savings time, as well as implicit historical information that gets
lost when you reduce it to a number.  Admittedly, Pakistan doesn't
seem to have DST, but that's the way it is.

In general, the system time zone is stored in the file /etc/localtime.
You can set it with:

  # cp /usr/share/zoneinfo/Asia/Karachi /etc/localtime 
  # date
  Fri Apr 16 08:55:27 PKT 2004

If you remove it, it defaults to "GMT" (really UTC):

  # rm /etc/localtime
  # date
  Fri Apr 16 03:55:37 GMT 2004

Even then, you can specify the time zone explicitly with the TZ
environment variable:

  # TZ=Asia/Karachi date
  Fri Apr 16 08:55:45 PKT 2004

Greg
--
When replying to this message, please copy the original recipients.
If you don't, I may ignore the reply or reply to the original recipients.
For more information, see http://www.lemis.com/questions.html
Note: I discard all HTML mail unseen.
Finger grog at FreeBSD.org for PGP public key.
See complete headers for address and phone numbers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040416/c063fb6a/attachment.bin


More information about the freebsd-questions mailing list