This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib 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: strftime improvements


Jeff,

On Feb 16 16:18, Jeff Johnston wrote:
> Patch checked in.  I made two minor changes to remove some compiler 
> warnings I was getting.  They may already have been there before the patch.

the below patch breaks building Cygwin.  The reason is that strftime
now references the external symbol __tzrule from tzset_r.c.  While
Cygwin uses newlib's strftime, it doesn't use newlib's tzset implementation.
The Cygwin implementation, introduced by DJ Delorie in 1999, supports
getting timezone information from Windows as well as reading the zoneinfo
file, so we don't want to switch over to newlib's tzset implementation.

Unfortunately, since referencing __tzrule pulls in tzset_r.o when
linking, we're now getting multiple defined symbols.

To solve this problem, we can either eliminate using __tzrule from strftime,
or Cygwin could provide a __tzrule.  The latter seems to make more sense,
so I've implemented providing __tzrule in our own implementation, though
with only the offset member having a useful meaning.

The problem here is, that the datatype of __tzrule has to be identical to
the implementation in newlib.  But the definition of the type __tzrule_type
is unfortunately local to newlib/libc/time.  That requires to duplicate
the definition locally in Cygwin which is a mess if the definition in
newlib changes for some reason.

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 ?


Thanks,
Corinna


> Eric Blake wrote:
> >Following up to my post last month about broken strftime(3), here is a
> >patch that implements all the remaining missing functionality required by
> >POSIX, as well as improving the documentation.
> >
> >Note that there are still some useful non-POSIX extensions out there that
> >might be worth implementing.  In glibc, strftime(NULL, (size_t)UINT_MAX,
> >format, &tm) returns the number of characters that would be placed into a
> >non-NULL string, great for allocating a string to have exact length.  And
> >in Solaris, strftime(s, len, NULL, &tm) uses "%c" as the default format.
> >
> >Also, something I did not know how to fix - POSIX requires that <time.h>
> >include extern int daylight, extern long timezone, and extern char
> >*tzname.  But as currently written, <time.h> has daylight and tzname
> >exposed only under __CYGWIN__, and timezone is a function instead of a
> >long unless timezonevar is defined.
> >
> >2005-02-14  Eric Blake  <ebb9@byu.net>
> >
> >	* libc/time/time.tex: Improve the documentation.
> >	* libc/time/strftime.c: Improve the documentation.
> >	(iso_year_adjust): New helper function.
> >	(strftime): Simplify '%E' and '%O'. Change '%c' to use
> >	recursion. Fix '%C', '%y', and '%Y' to deal with years with more
> >	than 4 characters.  Combine '%d' and '%e'. Implement '%D', '%F',
> >	'%g', '%G', '%n', '%R', '%t', '%T', '%u', '%V', '%X', and '%z'.
> >	Avoid core dumps on valid inputs (maxsize == 0, or
> >	tim_p->tm_isdst > 1).
> >

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat, Inc.


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