This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PING^2] RFC [PATCH] BZ#1077902: New API gettimezone

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....

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]