This is the mail archive of the libc-locales@sources.redhat.com mailing list for the GNU libc locales 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: Talk about glibc locale format


[dropping debian-i18n, this discussion is more relevant to libc-locales]

On Thu, Jul 07, 2005 at 12:32:21AM +0200, Keld Jørn Simonsen wrote:
[...]
> On Wed, Jul 06, 2005 at 12:20:00AM +0200, Denis Barbier wrote:
> > My example was not very good, one can indeed assume that cal writers
> > are able to make such date computations.  But the problem is that
> > ISO 14652 new definition is not compatible with "struct tm" as described
> > in http://www.opengroup.org/onlinepubs/009695399/basedefs/time.h.html
> > so any libc function (like gmtime, localtime, strftime,...) which work
> > with "struct tm" is no more POSIX compatible. 
> 
> Why is it not compatible? It is easy to convert the specs in strings of
> 14652 to that data format. Even I could do that! The only problem is
> that there is a spec that says what the first weekday is, and then a
> correspondance to the individual daynames. If the week was 7 days (which
> is almost universal) and the week begins on a monday, then you just have
> to rearrange the strings a little. I am not sure if the week begins
> on a saturday in some countries, I think there may be a case for arabic
> countries there. But it is easy from the specs to arrange normal 7 day
> weeks in an internal format that is conformant to POSIX. And then from
> there the APIs work.

All right, I now see your point, thank you for explaining.
The new version at
  http://people.debian.org/~barbier/talks/debconf5/glibc-locale.pdf
should address all your remarks.

> > There are 2 distinct problems:
> >   a. How to specify first day of week?
> >   b. How to handle different calendars?
> > (a) could have been easily solved by setting first_weekday to a value
> > between 0 and 6 (i.e. with a semantics similar to %w, 0=Sunday ...
> > 6=Saturday).
> 
> Well, the current semantics of 14652 is similar to that, the only thing
> is Sunday=7.

I disagree again, Sunday=7 only if the first day specified in the "week"
field corresponds to a Monday.  E.g. if "week" is 7;19971130;7, then
1=Sunday.
As you explain, libc can internally store another value (which is then
identical to mine), but I still prefer my solution (which is much more
simple) until you implement yours and receive support from users ;)

> This is easy to handle: if (day ==7) day= 0;
> And then with sunday=7 there is a direct correspondance to ISO 8601.
> Also one of the aims of 14652 was to get national ISO members to
> do or be involved in making the locales. For them it is not natural that
> Sunday is 0. It is more natural for them to follow ISO 8601 day
> numbering, which is almost the same.

This is also true with my solution.

Denis


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