strftime improvements

Jeff Johnston
Wed Feb 23 19:21:00 GMT 2005

Corinna Vinschen wrote:
> Hi Jeff,
> On Feb 18 14:49, Jeff Johnston wrote:
>>Corinna Vinschen wrote:
>>>So the question is, can we move the definition of __tzrule_type to a header
>>>file which is accessible from Cygwin, e.g. sys/time.h or sys/types.h ?
>>I have no problem with moving the type into sys/types.h, but I would like 
>>to suggest a further change as well.  I would like to see the definition 
>>moved into a separate file with an access function (e.g. 
>>__get_tzrule_ptr()) .  Each libc/time function needing access would fetch 
>>the address dynamically and there wouldn't be a global variable.  If you 
>>don't have time to do this, I'll do it, but it affects your code on the 
>>other side in Cygwin.
> it would be nice if you could do it.  I'll just match my Cygwin code
> against your patch.
> Corinna

Sorry for the delay.  I just checked in a patch.  I put the types in time.h near 
the declaration of _tzset_r.  I also added a new function __gettzinfo() which 
gets access to some variables that were previously declared global and are used 
by the other time functions.  For example, the __tzrule array.  I changed 
_timezone in _tzset_r to be long as requested in another post.  For Cygwin, I 
left it asis as I imagine you will have to change it on the other side as well. 
  If you are ok with making _timezone long, just change libc/include/time.h and 
remove the added flag.

I noted that for Cygwin you #define timezone to be ((long int)_timezone) in 
certain instances.  This has a problem in that elsewhere there is a struct 
timezone declared (reent.h).

-- Jeff J.

More information about the Newlib mailing list