This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PING^2] RFC [PATCH] BZ#1077902: New API gettimezone
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Carlos O'Donell <carlos at redhat dot com>, P J P <pj dot pandit at yahoo dot co dot in>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Thu, 01 May 2014 10:53:06 -0700
- Subject: Re: [PING^2] RFC [PATCH] BZ#1077902: New API gettimezone
- Authentication-results: sourceware.org; auth=none
- References: <1396499286 dot 85118 dot YahooMailNeo at web192405 dot mail dot sg3 dot yahoo dot com> <534971E4 dot 6060001 at cs dot ucla dot edu> <53497633 dot 6060804 at redhat dot com> <1397324033 dot 69177 dot YahooMailNeo at web192403 dot mail dot sg3 dot yahoo dot com> <5349A4B0 dot 2070206 at redhat dot com> <1397375798 dot 36419 dot YahooMailNeo at web192401 dot mail dot sg3 dot yahoo dot com> <1397414803 dot 70882 dot YahooMailNeo at web192403 dot mail dot sg3 dot yahoo dot com> <534B8A9F dot 8030806 at redhat dot com> <1397469748 dot 42212 dot YahooMailNeo at web192405 dot mail dot sg3 dot yahoo dot com> <1398146221 dot 72442 dot YahooMailNeo at web192403 dot mail dot sg3 dot yahoo dot com> <1398755742 dot 94004 dot YahooMailNeo at web192405 dot mail dot sg3 dot yahoo dot com> <535F74EE dot 8010002 at redhat dot com> <1398775268 dot 92264 dot YahooMailNeo at web192405 dot mail dot sg3 dot yahoo dot com> <535FC11B dot 3000906 at cs dot ucla dot edu> <1398801168 dot 81041 dot YahooMailNeo at web192406 dot mail dot sg3 dot yahoo dot com> <5360378D dot 1060306 at cs dot ucla dot edu> <1398872997 dot 84757 dot YahooMailNeo at web192402 dot mail dot sg3 dot yahoo dot com> <53614148 dot 90603 at cs dot ucla dot edu> <5361D8D1 dot 60400 at redhat dot com> <5361E805 dot 9080606 at cs dot ucla dot edu> <5361F22E dot 3070206 at redhat dot com>
On 05/01/2014 12:05 AM, Carlos O'Donell wrote:
getenv ("TZ"); right now on an OpenShift gear returns "", and if I
pass my cartridge to someone running in Mumbai, and they use it the
chroot'd process prints the wrong time.
If getenv ("TZ") returns the empty string both here and in Mumbai, glibc
localtime will use UTC in both places, so you should be OK.
How do I get the TZ out of the running system?
getenv ("TZ").
Sure, but what do I set TZ to?
Whatever you want. If you're trying to recreate your local environment
on a remote host, set TZ to the same value as the local host, or leave
it unset if it's unset on the local host. So long as your tz files are
the same in both places, this should work.
It seems way more sensible to just provide the missing symmetric
portion of the API than to say "You just have to get all other distros
or frameworks you use to set TZ."
You don't need to get all other distros or frameworks. Just ensure that
your tz files are the same in both places. Which is something you need
to do *anyway*, if you want TZ settings to work the same in both places.
On top of all this copying in /etc/localtime for say Docker containers
forces a COW for the changed file
That's a minor optimization issue, one that comes up with any sort of
configuration file, not just time zones. So you can address it the same
way you address it for the rest of your configuration. If it were me,
I'd simply remove /etc/localtime from all the hosts in question, as
that's easier to administer and is faster at runtime. But if someone
wants all their servers to report Mumbai localtime, then whatever floats
their boat....