This is the mail archive of the cygwin mailing list for the Cygwin 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: localtime and TZ


On 10/30/2010 8:58 AM, Ken Brown wrote:
I've looked at Cygwin's localtime.cc, and the behavior I'm complaining
about is caused by the following code at the beginning of tzset:

const char * name = getenv("TZ");

	if (name == NULL) {
		if (!lcl_is_set)
			tzsetwall();
		goto out;
	}

So getting rid of 'if (!lcl_is_set)' would solve the problem.  But this
would be inefficient, because it would mean that tzsetwall gets called
every time tzset is called if TZ is never set.  To get around that, one
could have tzsetwall set TZ.

It seems that tzset and tzsetwall used to behave the way I'm proposing
before the following two changes were made:

2007-12-11 Corinna Vinschen<corinna@vinschen.de>

	* localtime.cc (tzset): Call tzsetwall only if it hasn't been
	called before.

2007-08-01 Corinna Vinschen<corinna@vinschen.de>

* localtime.cc (tzsetwall): Don't set TZ.

I've just found the reason for the 2007-08-01 change:


http://www.cygwin.com/ml/cygwin/2007-08/msg00041.html

So I don't know what should be done.

How's the attached patch? I'm not set up to build cygwin1.dll, so I can't test it right now. I hope the intent is clear in case I got something wrong.


Ken

Attachment: tzset.patch
Description: Text document

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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