computing times in other zones without setting TZ

Paul Eggert eggert at
Wed Apr 8 00:56:47 UTC 1998

   From: 	Guenther Grau[SMTP:Guenther.Grau at]
   Sent: 	Tuesday, April 07, 1998 12:36 PM

   In my application I need to know, the time difference
   between any given time in any given timezone, and UTC. Is
   this possible to do WITHOUT changing the TZ environment

Not without some hacking.

You could take the public domain tz code
<>, or the GNU C library code
<>, and make a truly
reentrant version of the localtime function, so that you can pass the
time zone rule as a separate argument to your modified version of

If you do this, please send your improvements to the original authors;
you're not the first to have asked about this but nobody has
implemented it yet as far as I know.

More information about the tz mailing list